[CMake] Problem with FindBISON.cmake in Spanish language
Karl Krissian
krissian at dis.ulpgc.es
Mon Oct 18 05:49:51 EDT 2010
Hi,
In a Spanish language (linux), the command bison --version outputs:
bison (GNU bison) 2.4.1 etc...
while in an English language, the command bison --version outputs:
bison (GNU Bison) 2.4.1 etc...
the difference is the uppercase or lowercase b in GNU bison.
This difference creates a problem in FindBISON.cmake for the variable
BISON_VERSION, which relies on the English output:
EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
OUTPUT_VARIABLE BISON_version_output
ERROR_VARIABLE BISON_version_error
RESULT_VARIABLE BISON_version_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT ${BISON_version_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\"
failed with ou
tput:\n${BISON_version_error}")
ELSE()
STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
BISON_VERSION "${BISON_version_output}")
ENDIF()
and with the nightly build of cmake, the variable BISON_VERSION appears
in CMakeCache.txt and, in Spanish, generates an error since it contains
the full ouput of the command "bison --version" instead of only the
version number.
There are many ways to fix it, by changing the regular expression in the
REPLACE command, one way is to write
STRING(REGEX REPLACE "^bison \\(GNU [Bb]ison\\) ([^\n]+)\n.*" "\\1"
BISON_VERSION "${BISON_version_output}")
Hope it can help for the next release,
Regards,
Karl Krissian
More information about the CMake
mailing list