summaryrefslogtreecommitdiffstats
path: root/Modules/CheckCSourceCompiles.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/CheckCSourceCompiles.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/CheckCSourceCompiles.cmake')
-rw-r--r--Modules/CheckCSourceCompiles.cmake88
1 files changed, 44 insertions, 44 deletions
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 2669336..3c6e6a9 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -24,43 +24,43 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-INCLUDE("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/CMakeExpandImportedTargets.cmake")
-MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
- IF("${VAR}" MATCHES "^${VAR}$")
- SET(_FAIL_REGEX)
- SET(_key)
- FOREACH(arg ${ARGN})
- IF("${arg}" MATCHES "^(FAIL_REGEX)$")
- SET(_key "${arg}")
- ELSEIF(_key)
- LIST(APPEND _${_key} "${arg}")
- ELSE()
- MESSAGE(FATAL_ERROR "Unknown argument:\n ${arg}\n")
- ENDIF()
- ENDFOREACH()
- SET(MACRO_CHECK_FUNCTION_DEFINITIONS
+macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
+ if("${VAR}" MATCHES "^${VAR}$")
+ set(_FAIL_REGEX)
+ set(_key)
+ foreach(arg ${ARGN})
+ if("${arg}" MATCHES "^(FAIL_REGEX)$")
+ set(_key "${arg}")
+ elseif(_key)
+ list(APPEND _${_key} "${arg}")
+ else()
+ message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
+ endif()
+ endforeach()
+ set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
- IF(CMAKE_REQUIRED_LIBRARIES)
+ if(CMAKE_REQUIRED_LIBRARIES)
# this one translates potentially used imported library targets to their files on disk
CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}")
- SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
+ set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}")
- ELSE(CMAKE_REQUIRED_LIBRARIES)
- SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
- ENDIF(CMAKE_REQUIRED_LIBRARIES)
- IF(CMAKE_REQUIRED_INCLUDES)
- SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
+ else(CMAKE_REQUIRED_LIBRARIES)
+ set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
+ endif(CMAKE_REQUIRED_LIBRARIES)
+ if(CMAKE_REQUIRED_INCLUDES)
+ set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
- ELSE(CMAKE_REQUIRED_INCLUDES)
- SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
- ENDIF(CMAKE_REQUIRED_INCLUDES)
- FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
+ else(CMAKE_REQUIRED_INCLUDES)
+ set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
+ endif(CMAKE_REQUIRED_INCLUDES)
+ file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
"${SOURCE}\n")
- MESSAGE(STATUS "Performing Test ${VAR}")
- TRY_COMPILE(${VAR}
+ message(STATUS "Performing Test ${VAR}")
+ try_compile(${VAR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
@@ -69,27 +69,27 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
- FOREACH(_regex ${_FAIL_REGEX})
- IF("${OUTPUT}" MATCHES "${_regex}")
- SET(${VAR} 0)
- ENDIF()
- ENDFOREACH()
+ foreach(_regex ${_FAIL_REGEX})
+ if("${OUTPUT}" MATCHES "${_regex}")
+ set(${VAR} 0)
+ endif()
+ endforeach()
- IF(${VAR})
- SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
- MESSAGE(STATUS "Performing Test ${VAR} - Success")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ if(${VAR})
+ set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
+ message(STATUS "Performing Test ${VAR} - Success")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
- ELSE(${VAR})
- MESSAGE(STATUS "Performing Test ${VAR} - Failed")
- SET(${VAR} "" CACHE INTERNAL "Test ${VAR}")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ else(${VAR})
+ message(STATUS "Performing Test ${VAR} - Failed")
+ set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
- ENDIF(${VAR})
- ENDIF("${VAR}" MATCHES "^${VAR}$")
-ENDMACRO(CHECK_C_SOURCE_COMPILES)
+ endif(${VAR})
+ endif("${VAR}" MATCHES "^${VAR}$")
+endmacro(CHECK_C_SOURCE_COMPILES)