summaryrefslogtreecommitdiffstats
path: root/Modules/FindFLEX.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/FindFLEX.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/FindFLEX.cmake')
-rw-r--r--Modules/FindFLEX.cmake106
1 files changed, 53 insertions, 53 deletions
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 586f77a..64c1d53 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -8,7 +8,7 @@
# FLEX_INCLUDE_DIRS - The path to the flex headers
#
# The minimum required version of flex can be specified using the
-# standard syntax, e.g. FIND_PACKAGE(FLEX 2.5.13)
+# standard syntax, e.g. find_package(FLEX 2.5.13)
#
#
# If flex is found on the system, the module provides the macro:
@@ -63,73 +63,73 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-FIND_PROGRAM(FLEX_EXECUTABLE flex DOC "path to the flex executable")
-MARK_AS_ADVANCED(FLEX_EXECUTABLE)
+find_program(FLEX_EXECUTABLE flex DOC "path to the flex executable")
+mark_as_advanced(FLEX_EXECUTABLE)
-FIND_LIBRARY(FL_LIBRARY NAMES fl
+find_library(FL_LIBRARY NAMES fl
DOC "Path to the fl library")
-FIND_PATH(FLEX_INCLUDE_DIR FlexLexer.h
+find_path(FLEX_INCLUDE_DIR FlexLexer.h
DOC "Path to the flex headers")
-MARK_AS_ADVANCED(FL_LIBRARY FLEX_INCLUDE_DIR)
+mark_as_advanced(FL_LIBRARY FLEX_INCLUDE_DIR)
-SET(FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIR})
-SET(FLEX_LIBRARIES ${FL_LIBRARY})
+set(FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIR})
+set(FLEX_LIBRARIES ${FL_LIBRARY})
-IF(FLEX_EXECUTABLE)
+if(FLEX_EXECUTABLE)
- EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version
+ execute_process(COMMAND ${FLEX_EXECUTABLE} --version
OUTPUT_VARIABLE FLEX_version_output
ERROR_VARIABLE FLEX_version_error
RESULT_VARIABLE FLEX_version_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
- IF(NOT ${FLEX_version_result} EQUAL 0)
- 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()
+ if(NOT ${FLEX_version_result} EQUAL 0)
+ 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()
# older versions of flex printed "/full/path/to/executable version X.Y"
# newer versions use "basename(executable) X.Y"
- GET_FILENAME_COMPONENT(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME)
- STRING(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)$" "\\2"
+ get_filename_component(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME)
+ string(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)$" "\\2"
FLEX_VERSION "${FLEX_version_output}")
- UNSET(FLEX_EXE_NAME)
- ENDIF()
+ unset(FLEX_EXE_NAME)
+ endif()
#============================================================
# FLEX_TARGET (public macro)
#============================================================
#
- MACRO(FLEX_TARGET Name Input Output)
- SET(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
- IF(${ARGC} GREATER 3)
- IF(${ARGC} EQUAL 5)
- IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
- SET(FLEX_EXECUTABLE_opts "${ARGV4}")
- SEPARATE_ARGUMENTS(FLEX_EXECUTABLE_opts)
- ELSE()
- MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
- ENDIF()
- ELSE()
- MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
- ENDIF()
- ENDIF()
-
- ADD_CUSTOM_COMMAND(OUTPUT ${Output}
+ macro(FLEX_TARGET Name Input Output)
+ set(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
+ if(${ARGC} GREATER 3)
+ if(${ARGC} EQUAL 5)
+ if("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+ set(FLEX_EXECUTABLE_opts "${ARGV4}")
+ separate_arguments(FLEX_EXECUTABLE_opts)
+ else()
+ message(SEND_ERROR ${FLEX_TARGET_usage})
+ endif()
+ else()
+ message(SEND_ERROR ${FLEX_TARGET_usage})
+ endif()
+ endif()
+
+ add_custom_command(OUTPUT ${Output}
COMMAND ${FLEX_EXECUTABLE}
ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input}
DEPENDS ${Input}
COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
- SET(FLEX_${Name}_DEFINED TRUE)
- SET(FLEX_${Name}_OUTPUTS ${Output})
- SET(FLEX_${Name}_INPUT ${Input})
- SET(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
- ENDMACRO(FLEX_TARGET)
+ set(FLEX_${Name}_DEFINED TRUE)
+ set(FLEX_${Name}_OUTPUTS ${Output})
+ set(FLEX_${Name}_INPUT ${Input})
+ set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
+ endmacro(FLEX_TARGET)
#============================================================
@@ -137,24 +137,24 @@ IF(FLEX_EXECUTABLE)
# ADD_FLEX_BISON_DEPENDENCY (public macro)
#============================================================
#
- MACRO(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget)
+ macro(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget)
- IF(NOT FLEX_${FlexTarget}_OUTPUTS)
- MESSAGE(SEND_ERROR "Flex target `${FlexTarget}' does not exists.")
- ENDIF()
+ if(NOT FLEX_${FlexTarget}_OUTPUTS)
+ message(SEND_ERROR "Flex target `${FlexTarget}' does not exists.")
+ endif()
- IF(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
- MESSAGE(SEND_ERROR "Bison target `${BisonTarget}' does not exists.")
- ENDIF()
+ if(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
+ message(SEND_ERROR "Bison target `${BisonTarget}' does not exists.")
+ endif()
- SET_SOURCE_FILES_PROPERTIES(${FLEX_${FlexTarget}_OUTPUTS}
+ set_source_files_properties(${FLEX_${FlexTarget}_OUTPUTS}
PROPERTIES OBJECT_DEPENDS ${BISON_${BisonTarget}_OUTPUT_HEADER})
- ENDMACRO(ADD_FLEX_BISON_DEPENDENCY)
+ endmacro(ADD_FLEX_BISON_DEPENDENCY)
#============================================================
-ENDIF(FLEX_EXECUTABLE)
+endif(FLEX_EXECUTABLE)
-INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX REQUIRED_VARS FLEX_EXECUTABLE
VERSION_VAR FLEX_VERSION)