From 4a8920b1d4ea5e505edeb862dd27fb311673bef5 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 16 Mar 2015 13:31:33 +0100 Subject: [PATCH] Improve Flex version detection on Windows refs #8750 --- lib/config/CMakeLists.txt | 4 ---- third-party/cmake/FindFLEX.cmake | 8 +++++++- tools/mkclass/CMakeLists.txt | 4 ---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/config/CMakeLists.txt b/lib/config/CMakeLists.txt index 9b38981e5..52cbf5640 100644 --- a/lib/config/CMakeLists.txt +++ b/lib/config/CMakeLists.txt @@ -18,10 +18,6 @@ find_package(BISON 2.3.0 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) set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc PROPERTY EXCLUDE_UNITY_BUILD TRUE) diff --git a/third-party/cmake/FindFLEX.cmake b/third-party/cmake/FindFLEX.cmake index df151fb36..cd54832c3 100644 --- a/third-party/cmake/FindFLEX.cmake +++ b/third-party/cmake/FindFLEX.cmake @@ -117,6 +117,12 @@ IF(FLEX_EXECUTABLE) FLEX_VERSION "${FLEX_version_output}") 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) #============================================================ @@ -176,4 +182,4 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX FLEX_EXECUTABLE FLEX_VERSION) -# FindFLEX.cmake ends here \ No newline at end of file +# FindFLEX.cmake ends here diff --git a/tools/mkclass/CMakeLists.txt b/tools/mkclass/CMakeLists.txt index e5beb13b6..a94c6046d 100644 --- a/tools/mkclass/CMakeLists.txt +++ b/tools/mkclass/CMakeLists.txt @@ -18,10 +18,6 @@ find_package(BISON 2.3.0 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) flex_target(class_lexer class_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/class_lexer.cc) add_flex_bison_dependency(class_lexer class_parser)