summaryrefslogtreecommitdiffstats
path: root/Modules/FindBISON.cmake
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2010-11-09 20:28:33 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2010-11-09 20:28:33 (GMT)
commit384816e4deb5e171e4a0651ef08c2af9c59b356a (patch)
tree2fb4fdba6eac97ab71b0bec294ba2f2a3a3a6bfb /Modules/FindBISON.cmake
parent5965ff51127c7baaa23b06df510c8adcc5435880 (diff)
parent506805c999a5b91130e4811607a261117354d40a (diff)
downloadCMake-384816e4deb5e171e4a0651ef08c2af9c59b356a.zip
CMake-384816e4deb5e171e4a0651ef08c2af9c59b356a.tar.gz
CMake-384816e4deb5e171e4a0651ef08c2af9c59b356a.tar.bz2
Merge topic 'FixBisonWithLocale'
506805c Make FindBISON work properly with non-C locales (#11326)
Diffstat (limited to 'Modules/FindBISON.cmake')
-rw-r--r--Modules/FindBISON.cmake15
1 files changed, 11 insertions, 4 deletions
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index 1120fc1..a3308da 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -51,12 +51,19 @@ FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable")
MARK_AS_ADVANCED(BISON_EXECUTABLE)
IF(BISON_EXECUTABLE)
+ # the bison commands should be executed with the C locale, otherwise
+ # the message (which are parsed) may be translated
+ SET(_Bison_SAVED_LC_ALL "$ENV{LC_ALL}")
+ SET(ENV{LC_ALL} C)
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)
+
+ SET(ENV{LC_ALL} ${_Bison_SAVED_LC_ALL})
+
IF(NOT ${BISON_version_result} EQUAL 0)
MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
ELSE()
@@ -115,7 +122,7 @@ IF(BISON_EXECUTABLE)
IF("${ARGV5}" STREQUAL "VERBOSE")
BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}")
ENDIF()
-
+
IF("${ARGV5}" STREQUAL "COMPILE_FLAGS")
BISON_TARGET_option_extraopts("${ARGV6}")
ENDIF()
@@ -125,10 +132,10 @@ IF(BISON_EXECUTABLE)
LIST(APPEND BISON_TARGET_cmdopt "-d")
STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}")
STRING(REPLACE "c" "h" _fileext ${_fileext})
- STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
+ STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
BISON_${Name}_OUTPUT_HEADER "${ARGV2}")
LIST(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}")
-
+
ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs}
${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE}
@@ -136,7 +143,7 @@ IF(BISON_EXECUTABLE)
DEPENDS ${ARGV1}
COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-
+
# define target variables
SET(BISON_${Name}_DEFINED TRUE)
SET(BISON_${Name}_INPUT ${ARGV1})