summaryrefslogtreecommitdiffstats
path: root/Modules/FindBISON.cmake
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2012-08-13 17:47:32 (GMT)
committerBrad King <brad.king@kitware.com>2012-08-13 18:19:16 (GMT)
commit77543bde41b0e52c3959016698b529835945d62d (patch)
treeff63e5fbec326c4a5d821e7496c6d2cb52f75b92 /Modules/FindBISON.cmake
parent7bbaa4283de26864b2e55e819db0884771585467 (diff)
downloadCMake-77543bde41b0e52c3959016698b529835945d62d.zip
CMake-77543bde41b0e52c3959016698b529835945d62d.tar.gz
CMake-77543bde41b0e52c3959016698b529835945d62d.tar.bz2
Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
Diffstat (limited to 'Modules/FindBISON.cmake')
-rw-r--r--Modules/FindBISON.cmake132
1 files changed, 66 insertions, 66 deletions
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index 7af3367..d0e0a22 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -47,46 +47,46 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable")
-MARK_AS_ADVANCED(BISON_EXECUTABLE)
+find_program(BISON_EXECUTABLE bison DOC "path to the bison executable")
+mark_as_advanced(BISON_EXECUTABLE)
-IF(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)
+ set(_Bison_SAVED_LC_ALL "$ENV{LC_ALL}")
+ set(ENV{LC_ALL} C)
- EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
+ 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})
+ 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()
+ if(NOT ${BISON_version_result} EQUAL 0)
+ message(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
+ else()
# Bison++
- IF("${BISON_version_output}" MATCHES "^bison\\+\\+")
- STRING(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1"
+ if("${BISON_version_output}" MATCHES "^bison\\+\\+")
+ string(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1"
BISON_VERSION "${BISON_version_output}")
# GNU Bison
- ELSEIF("${BISON_version_output}" MATCHES "^bison[^+]")
- STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
+ elseif("${BISON_version_output}" MATCHES "^bison[^+]")
+ string(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
BISON_VERSION "${BISON_version_output}")
- ELSEIF("${BISON_version_output}" MATCHES "^GNU Bison ")
- STRING(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2"
+ elseif("${BISON_version_output}" MATCHES "^GNU Bison ")
+ string(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2"
BISON_VERSION "${BISON_version_output}")
- ENDIF()
- ENDIF()
+ endif()
+ endif()
# internal macro
- MACRO(BISON_TARGET_option_verbose Name BisonOutput filename)
- LIST(APPEND BISON_TARGET_cmdopt "--verbose")
- GET_FILENAME_COMPONENT(BISON_TARGET_output_path "${BisonOutput}" PATH)
- GET_FILENAME_COMPONENT(BISON_TARGET_output_name "${BisonOutput}" NAME_WE)
- ADD_CUSTOM_COMMAND(OUTPUT ${filename}
+ macro(BISON_TARGET_option_verbose Name BisonOutput filename)
+ list(APPEND BISON_TARGET_cmdopt "--verbose")
+ get_filename_component(BISON_TARGET_output_path "${BisonOutput}" PATH)
+ get_filename_component(BISON_TARGET_output_name "${BisonOutput}" NAME_WE)
+ add_custom_command(OUTPUT ${filename}
COMMAND ${CMAKE_COMMAND}
ARGS -E copy
"${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
@@ -95,58 +95,58 @@ IF(BISON_EXECUTABLE)
"${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
- SET(BISON_${Name}_VERBOSE_FILE ${filename})
- LIST(APPEND BISON_TARGET_extraoutputs
+ set(BISON_${Name}_VERBOSE_FILE ${filename})
+ list(APPEND BISON_TARGET_extraoutputs
"${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output")
- ENDMACRO(BISON_TARGET_option_verbose)
+ endmacro(BISON_TARGET_option_verbose)
# internal macro
- MACRO(BISON_TARGET_option_extraopts Options)
- SET(BISON_TARGET_extraopts "${Options}")
- SEPARATE_ARGUMENTS(BISON_TARGET_extraopts)
- LIST(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
- ENDMACRO(BISON_TARGET_option_extraopts)
+ macro(BISON_TARGET_option_extraopts Options)
+ set(BISON_TARGET_extraopts "${Options}")
+ separate_arguments(BISON_TARGET_extraopts)
+ list(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
+ endmacro(BISON_TARGET_option_extraopts)
#============================================================
# BISON_TARGET (public macro)
#============================================================
#
- MACRO(BISON_TARGET Name BisonInput BisonOutput)
- SET(BISON_TARGET_output_header "")
- SET(BISON_TARGET_cmdopt "")
- SET(BISON_TARGET_outputs "${BisonOutput}")
- IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
- MESSAGE(SEND_ERROR "Usage")
- ELSE()
+ macro(BISON_TARGET Name BisonInput BisonOutput)
+ set(BISON_TARGET_output_header "")
+ set(BISON_TARGET_cmdopt "")
+ set(BISON_TARGET_outputs "${BisonOutput}")
+ if(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+ message(SEND_ERROR "Usage")
+ else()
# Parsing parameters
- IF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
- IF("${ARGV3}" STREQUAL "VERBOSE")
+ if(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
+ if("${ARGV3}" STREQUAL "VERBOSE")
BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}")
- ENDIF()
- IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+ endif()
+ if("${ARGV3}" STREQUAL "COMPILE_FLAGS")
BISON_TARGET_option_extraopts("${ARGV4}")
- ENDIF()
- ENDIF()
+ endif()
+ endif()
- IF(${ARGC} EQUAL 7)
- IF("${ARGV5}" STREQUAL "VERBOSE")
+ if(${ARGC} EQUAL 7)
+ if("${ARGV5}" STREQUAL "VERBOSE")
BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}")
- ENDIF()
+ endif()
- IF("${ARGV5}" STREQUAL "COMPILE_FLAGS")
+ if("${ARGV5}" STREQUAL "COMPILE_FLAGS")
BISON_TARGET_option_extraopts("${ARGV6}")
- ENDIF()
- ENDIF()
+ endif()
+ endif()
# Header's name generated by bison (see option -d)
- LIST(APPEND BISON_TARGET_cmdopt "-d")
- STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}")
- STRING(REPLACE "c" "h" _fileext ${_fileext})
- STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
+ list(APPEND BISON_TARGET_cmdopt "-d")
+ string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}")
+ string(REPLACE "c" "h" _fileext ${_fileext})
+ string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
BISON_${Name}_OUTPUT_HEADER "${ARGV2}")
- LIST(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}")
+ list(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}")
- ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs}
+ add_custom_command(OUTPUT ${BISON_TARGET_outputs}
${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE}
ARGS ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1}
@@ -155,20 +155,20 @@ IF(BISON_EXECUTABLE)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
# define target variables
- SET(BISON_${Name}_DEFINED TRUE)
- SET(BISON_${Name}_INPUT ${ARGV1})
- SET(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs})
- SET(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
- SET(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
-
- ENDIF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
- ENDMACRO(BISON_TARGET)
+ set(BISON_${Name}_DEFINED TRUE)
+ set(BISON_${Name}_INPUT ${ARGV1})
+ set(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs})
+ set(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
+ set(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
+
+ endif(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+ endmacro(BISON_TARGET)
#
#============================================================
-ENDIF(BISON_EXECUTABLE)
+endif(BISON_EXECUTABLE)
-INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE
VERSION_VAR BISON_VERSION)