summaryrefslogtreecommitdiffstats
path: root/Modules/FindFLEX.cmake
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2012-01-20 16:44:00 (GMT)
committerRolf Eike Beer <eike@sf-mail.de>2012-01-20 17:27:43 (GMT)
commit2cf5df3e58842a3e0fdeb919414f32e53dbe0aec (patch)
tree81187d6d2f7734d660af057835149f45258f1406 /Modules/FindFLEX.cmake
parentb8ff1c1e72899e7381d93e44b00824faf73d94ab (diff)
downloadCMake-2cf5df3e58842a3e0fdeb919414f32e53dbe0aec.zip
CMake-2cf5df3e58842a3e0fdeb919414f32e53dbe0aec.tar.gz
CMake-2cf5df3e58842a3e0fdeb919414f32e53dbe0aec.tar.bz2
FindFLEX: fix version parsing for old flex versions
Diffstat (limited to 'Modules/FindFLEX.cmake')
-rw-r--r--Modules/FindFLEX.cmake6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 6a70b40..6309bc9 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -91,8 +91,12 @@ IF(FLEX_EXECUTABLE)
MESSAGE("Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}\nFLEX_VERSION will not be available")
ENDIF()
ELSE()
- STRING(REGEX REPLACE "^flex (.*)$" "\\1"
+ # older versions of flex printed "/full/path/to/executable version X.Y"
+ # newer versions use "basename(executable) X.Y"
+ GET_FILENAME_COMPONENT(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME)
+ STRING(REGEX REPLACE "^.*${FLEX_EXE_NAME} (version )?([0-9]+[^ ]*)$" "\\2"
FLEX_VERSION "${FLEX_version_output}")
+ UNSET(FLEX_EXE_NAME)
ENDIF()
#============================================================