CMakeLists.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #
  2. # SuperTux - miniswig build script
  3. # Copyright (C) 2007 Timothy Goya <tuxdev103@gmail.com>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #
  19. ## Project name to use as command prefix
  20. PROJECT(MINISWIG)
  21. ## add additional compiler switches
  22. ADD_DEFINITIONS(-include ${CMAKE_BINARY_DIR}/config.h)
  23. # the autogenerated bison/flex is not warning free usually
  24. REMOVE_DEFINITIONS(-Wall -W)
  25. ## Include paths to make generated files work
  26. INCLUDE_DIRECTORIES (${MINISWIG_SOURCE_DIR})
  27. ## build list of source files
  28. FILE(GLOB MINISWIG_SOURCES RELATIVE ${MINISWIG_SOURCE_DIR} create_docu.cpp create_wrapper.cpp main.cpp tree.cpp xmlwriter.cpp)
  29. ## Add target for bison parser generation
  30. MARK_AS_ADVANCED(BISON_EXECUTABLE)
  31. FIND_PROGRAM(BISON_EXECUTABLE bison)
  32. IF (NOT BISON_EXECUTABLE)
  33. MESSAGE(FATAL_ERROR "bison not found - aborting")
  34. ENDIF (NOT BISON_EXECUTABLE)
  35. ADD_CUSTOM_COMMAND(
  36. OUTPUT ${MINISWIG_BINARY_DIR}/parser.cpp ${MINISWIG_BINARY_DIR}/parser.hpp
  37. COMMAND ${BISON_EXECUTABLE}
  38. ARGS -d -o ${MINISWIG_BINARY_DIR}/parser.cpp ${MINISWIG_SOURCE_DIR}/parser.yy
  39. DEPENDS parser.yy
  40. )
  41. ## Add target for flex lexical analyzer generation
  42. MARK_AS_ADVANCED(FLEX_EXECUTABLE)
  43. FIND_PROGRAM(FLEX_EXECUTABLE flex)
  44. IF (NOT FLEX_EXECUTABLE)
  45. MESSAGE(FATAL_ERROR "flex not found - aborting")
  46. ENDIF (NOT FLEX_EXECUTABLE)
  47. ADD_CUSTOM_COMMAND(
  48. OUTPUT ${MINISWIG_BINARY_DIR}/lexer.cpp
  49. COMMAND ${FLEX_EXECUTABLE}
  50. ARGS -o ${MINISWIG_BINARY_DIR}/lexer.cpp ${MINISWIG_SOURCE_DIR}/lexer.ll
  51. DEPENDS lexer.ll ${MINISWIG_BINARY_DIR}/parser.hpp
  52. )
  53. IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  54. ADD_DEFINITIONS("-Wno-deprecated-register -Wno-unneeded-internal-declaration -Wno-unused-function")
  55. ENDIF()
  56. IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  57. ADD_DEFINITIONS("-Wno-unused-function")
  58. ENDIF()
  59. ## Add target for miniswig binary
  60. ADD_EXECUTABLE(miniswig ${MINISWIG_SOURCES} ${MINISWIG_BINARY_DIR}/parser.cpp ${MINISWIG_BINARY_DIR}/lexer.cpp)