summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-01-25 16:19:38 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-01-25 16:19:38 (GMT)
commitc444cf73dd3ffb7e1bea552cdea015af5f56981b (patch)
treee851fda07006885040092539ed3c5b8b1f4fa619
parentddc1eb5ecdc72b0ba2c4bad1a36a7a6875646248 (diff)
parent0b2e81c63ce6ca9dcf9d775d3f5cd22749e8c134 (diff)
downloadCMake-c444cf73dd3ffb7e1bea552cdea015af5f56981b.zip
CMake-c444cf73dd3ffb7e1bea552cdea015af5f56981b.tar.gz
CMake-c444cf73dd3ffb7e1bea552cdea015af5f56981b.tar.bz2
Merge topic 'flex-version'
0b2e81c FindFLEX: fix version parsing when the executable is quoted 2cf5df3 FindFLEX: fix version parsing for old flex versions
-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..586f77a 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()
#============================================================