FindFLEX.cmake: Fix issue 11249

FindFLEX no longer sense a CMake fatal error if executing "flex --version" fails
unless the REQUIRED argument was specified.
This commit is contained in:
Philip Lowman 2010-09-19 23:56:34 -04:00
parent c30c3ade9b
commit 38691d91a5
1 changed files with 5 additions and 1 deletions

View File

@ -78,7 +78,11 @@ IF(FLEX_EXECUTABLE)
RESULT_VARIABLE FLEX_version_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT ${FLEX_version_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_error}")
IF(FLEX_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_output}\n${FLEX_version_error}")
ELSE()
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"
FLEX_VERSION "${FLEX_version_output}")