Improve Flex version detection on Windows

refs #8750
This commit is contained in:
Gunnar Beutner 2015-03-16 13:31:33 +01:00
parent ae05c1ac13
commit 1fcb012976
3 changed files with 7 additions and 9 deletions

View File

@ -18,10 +18,6 @@
find_package(BISON 2.3.0 REQUIRED) find_package(BISON 2.3.0 REQUIRED)
find_package(FLEX 2.5.31 REQUIRED) find_package(FLEX 2.5.31 REQUIRED)
if("${FLEX_VERSION}" VERSION_LESS "2.5.31")
message(SEND_ERROR "Your version of flex is too old. You can specify an alternative path using -DFLEX_EXECUTABLE=/path/to/flex")
endif()
bison_target(config_parser config_parser.yy ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc) bison_target(config_parser config_parser.yy ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc)
set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc PROPERTY EXCLUDE_UNITY_BUILD TRUE) set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc PROPERTY EXCLUDE_UNITY_BUILD TRUE)

View File

@ -117,6 +117,12 @@ IF(FLEX_EXECUTABLE)
FLEX_VERSION "${FLEX_version_output}") FLEX_VERSION "${FLEX_version_output}")
ENDIF() ENDIF()
IF(FLEX_FIND_VERSION)
IF("${FLEX_VERSION}" VERSION_LESS "${FLEX_FIND_VERSION}")
MESSAGE(SEND_ERROR "Your version of flex is too old. You can specify an alternative path using -DFLEX_EXECUTABLE=/path/to/flex")
ENDIF()
ENDIF()
#============================================================ #============================================================
# FLEX_TARGET (public macro) # FLEX_TARGET (public macro)
#============================================================ #============================================================

View File

@ -18,10 +18,6 @@
find_package(BISON 2.3.0 REQUIRED) find_package(BISON 2.3.0 REQUIRED)
find_package(FLEX 2.5.31 REQUIRED) find_package(FLEX 2.5.31 REQUIRED)
if("${FLEX_VERSION}" VERSION_LESS "2.5.31")
message(SEND_ERROR "Your version of flex is too old. You can specify an alternative path using -DFLEX_EXECUTABLE=/path/to/flex")
endif()
bison_target(class_parser class_parser.yy ${CMAKE_CURRENT_BINARY_DIR}/class_parser.cc) bison_target(class_parser class_parser.yy ${CMAKE_CURRENT_BINARY_DIR}/class_parser.cc)
flex_target(class_lexer class_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/class_lexer.cc) flex_target(class_lexer class_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/class_lexer.cc)
add_flex_bison_dependency(class_lexer class_parser) add_flex_bison_dependency(class_lexer class_parser)