Make flex detection on Windows more robust

fixes #8913

Signed-off-by: Gunnar Beutner <gunnar@beutner.name>
This commit is contained in:
Paul Richards 2015-03-30 22:02:50 +01:00 committed by Gunnar Beutner
parent 17c929aabf
commit 14fa3ceaee
1 changed files with 2 additions and 2 deletions

View File

@ -100,7 +100,7 @@ MARK_AS_ADVANCED(FL_LIBRARY)
SET(FLEX_LIBRARIES ${FL_LIBRARY})
IF(FLEX_EXECUTABLE)
GET_FILENAME_COMPONENT(FLEX_EXECUTABLE_NAME ${FLEX_EXECUTABLE} NAME)
EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version
OUTPUT_VARIABLE FLEX_version_output
ERROR_VARIABLE FLEX_version_error
@ -113,7 +113,7 @@ 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"
STRING(REGEX REPLACE "^${FLEX_EXECUTABLE_NAME}[^ ]* (.*)$" "\\1"
FLEX_VERSION "${FLEX_version_output}")
ENDIF()