summaryrefslogtreecommitdiffstats
path: root/Source/CMakeLists.txt
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-06-13 15:00:29 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-06-13 15:00:29 (GMT)
commit29f7e505a50f502ab54c97f86d8b714184aed8ad (patch)
treef37987e1022912c6d194d6c04d628ac7e41a4b14 /Source/CMakeLists.txt
parent385cced66c27658e93c5b63ddc3424da0feb8a61 (diff)
downloadCMake-29f7e505a50f502ab54c97f86d8b714184aed8ad.zip
CMake-29f7e505a50f502ab54c97f86d8b714184aed8ad.tar.gz
CMake-29f7e505a50f502ab54c97f86d8b714184aed8ad.tar.bz2
ENH: Use the new parser that supports nested variables
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r--Source/CMakeLists.txt52
1 files changed, 52 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index ac822bb..b5d41d2 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -17,6 +17,55 @@ INCLUDE_DIRECTORIES(
# let cmake know it is supposed to use it
ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE)
+OPTION(CMAKE_REGENERATE_YACCLEX
+ "Regenerate YACC and LEXX files" OFF)
+MARK_AS_ADVANCED(CMAKE_REGENERATE_YACCLEX)
+IF(CMAKE_REGENERATE_YACCLEX)
+ FIND_PROGRAM(YACC_EXECUTABLE
+ NAMES yacc bison
+ PATHS /usr/bin
+ DOC "Yacc or Bison executable")
+ FIND_PROGRAM(FLEX_EXECUTABLE
+ NAMES flex
+ PATHS /usr/bin
+ DOC "Flex executable")
+ MARK_AS_ADVANCED(YACC_EXECUTABLE FLEX_EXECUTABLE)
+ IF(YACC_EXECUTABLE)
+ SET(BISON_FLAGS)
+ IF(YACC_EXECUTABLE MATCHES "bison")
+ SET(BISON_FLAGS "--yacc")
+ ENDIF(YACC_EXECUTABLE MATCHES "bison")
+ SET(yacc_files)
+ FOREACH(name cmCommandArgument)
+ SET(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Parser.y")
+ SET(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Parser.cxx")
+ SET(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}ParserTokens.h")
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${dst}"
+ DEPENDS "${src}"
+ COMMAND ${YACC_EXECUTABLE}
+ ARGS --name-prefix=${name}_yy --defines="${hdr}" -o"${dst}" "${src}")
+ SET(yacc_files ${yacc_files} "${dst}")
+ ENDFOREACH(name)
+ ADD_CUSTOM_TARGET(RerunYacc DEPENDS ${yacc_files})
+ ENDIF(YACC_EXECUTABLE)
+ IF(FLEX_EXECUTABLE)
+ SET(lex_files)
+ FOREACH(name cmCommandArgument)
+ SET(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Lexer.in.l")
+ SET(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.cxx")
+ SET(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.h")
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${dst}"
+ DEPENDS "${src}"
+ COMMAND ${FLEX_EXECUTABLE}
+ ARGS --prefix=${name}_yy --header-file="${hdr}" -o"${dst}" "${src}")
+ SET(lex_files ${lex_files} "${dst}")
+ ENDFOREACH(name)
+ ADD_CUSTOM_TARGET(RerunLex DEPENDS ${lex_files})
+ ENDIF(FLEX_EXECUTABLE)
+
+ENDIF(CMAKE_REGENERATE_YACCLEX)
#
# Sources for CMakeLib
#
@@ -26,6 +75,9 @@ SET(SRCS
cmCacheManager.h
cmCommands.cxx
cmCommands.h
+ cmCommandArgumentLexer.cxx
+ cmCommandArgumentParser.cxx
+ cmCommandArgumentParserHelper.cxx
cmCustomCommand.cxx
cmCustomCommand.h
cmDepends.cxx