summaryrefslogtreecommitdiff
path: root/Modules/CMakeDetermineCompilerABI.cmake
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2012-08-13 13:47:32 -0400
committerBrad King <brad.king@kitware.com>2012-08-13 14:19:16 -0400
commit77543bde41b0e52c3959016698b529835945d62d (patch)
treeff63e5fbec326c4a5d821e7496c6d2cb52f75b92 /Modules/CMakeDetermineCompilerABI.cmake
parent7bbaa4283de26864b2e55e819db0884771585467 (diff)
downloadcmake-77543bde41b0e52c3959016698b529835945d62d.tar.gz
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/CMakeDetermineCompilerABI.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake134
1 files changed, 67 insertions, 67 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 1c9899e64d..b79afdf54e 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -16,19 +16,19 @@
# This is used internally by CMake and should not be included by user
# code.
-INCLUDE(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
+include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
-FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
- IF(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED)
- MESSAGE(STATUS "Detecting ${lang} compiler ABI info")
+function(CMAKE_DETERMINE_COMPILER_ABI lang src)
+ if(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+ message(STATUS "Detecting ${lang} compiler ABI info")
# Compile the ABI identification source.
- SET(BIN "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDetermineCompilerABI_${lang}.bin")
- SET(CMAKE_FLAGS )
- IF(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
- SET(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
- ENDIF()
- TRY_COMPILE(CMAKE_DETERMINE_${lang}_ABI_COMPILED
+ set(BIN "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDetermineCompilerABI_${lang}.bin")
+ set(CMAKE_FLAGS )
+ if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
+ set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
+ endif()
+ try_compile(CMAKE_DETERMINE_${lang}_ABI_COMPILED
${CMAKE_BINARY_DIR} ${src}
CMAKE_FLAGS "${CMAKE_FLAGS}"
"-DCMAKE_${lang}_STANDARD_LIBRARIES="
@@ -41,40 +41,40 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
)
# Load the resulting information strings.
- IF(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
- MESSAGE(STATUS "Detecting ${lang} compiler ABI info - done")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ if(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+ message(STATUS "Detecting ${lang} compiler ABI info - done")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n")
- FILE(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[")
- FOREACH(info ${ABI_STRINGS})
- IF("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
- STRING(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}")
- ENDIF("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
- IF("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
- STRING(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}")
- ENDIF("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
- ENDFOREACH(info)
+ file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[")
+ foreach(info ${ABI_STRINGS})
+ if("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
+ string(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}")
+ endif("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
+ if("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
+ string(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}")
+ endif("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
+ endforeach(info)
- IF(ABI_SIZEOF_DPTR)
- SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
- ELSEIF(CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT)
- SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE)
- ENDIF(ABI_SIZEOF_DPTR)
+ if(ABI_SIZEOF_DPTR)
+ set(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
+ elseif(CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT)
+ set(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE)
+ endif(ABI_SIZEOF_DPTR)
- IF(ABI_NAME)
- SET(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE)
- ENDIF(ABI_NAME)
+ if(ABI_NAME)
+ set(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE)
+ endif(ABI_NAME)
# Parse implicit linker information for this language, if available.
- SET(implicit_dirs "")
- SET(implicit_libs "")
- SET(MULTI_ARCH FALSE)
- IF(DEFINED CMAKE_OSX_ARCHITECTURES)
- IF( "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" )
- SET(MULTI_ARCH TRUE)
- ENDIF()
- ENDIF()
- IF(CMAKE_${lang}_VERBOSE_FLAG
+ set(implicit_dirs "")
+ set(implicit_libs "")
+ set(MULTI_ARCH FALSE)
+ if(DEFINED CMAKE_OSX_ARCHITECTURES)
+ if( "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" )
+ set(MULTI_ARCH TRUE)
+ endif()
+ endif()
+ if(CMAKE_${lang}_VERBOSE_FLAG
# Implicit link information cannot be used explicitly for
# multiple OS X architectures, so we skip it.
AND NOT MULTI_ARCH
@@ -82,50 +82,50 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode)
CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log
"${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Parsed ${lang} implicit link information from above output:\n${log}\n\n")
- ENDIF()
+ endif()
# for VS IDE Intel Fortran we have to figure out the
# implicit link path for the fortran run time using
# a try-compile
- IF("${lang}" MATCHES "Fortran"
+ if("${lang}" MATCHES "Fortran"
AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
- SET(_desc "Determine Intel Fortran Compiler Implicit Link Path")
- MESSAGE(STATUS "${_desc}")
+ set(_desc "Determine Intel Fortran Compiler Implicit Link Path")
+ message(STATUS "${_desc}")
# Build a sample project which reports symbols.
- TRY_COMPILE(IFORT_LIB_PATH_COMPILED
+ try_compile(IFORT_LIB_PATH_COMPILED
${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath
${CMAKE_ROOT}/Modules/IntelVSImplicitPath
IntelFortranImplicit
CMAKE_FLAGS
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
OUTPUT_VARIABLE _output)
- FILE(WRITE
+ file(WRITE
"${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
"${_output}")
- INCLUDE(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
- SET(_desc "Determine Intel Fortran Compiler Implicit Link Path -- done")
- MESSAGE(STATUS "${_desc}")
- ENDIF()
+ include(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
+ set(_desc "Determine Intel Fortran Compiler Implicit Link Path -- done")
+ message(STATUS "${_desc}")
+ endif()
- SET(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
- SET(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
+ set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
+ set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
# Detect library architecture directory name.
- IF(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
- FOREACH(dir ${implicit_dirs})
- IF("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
- GET_FILENAME_COMPONENT(arch "${dir}" NAME)
- SET(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${arch}" PARENT_SCOPE)
- BREAK()
- ENDIF()
- ENDFOREACH()
- ENDIF()
+ if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
+ foreach(dir ${implicit_dirs})
+ if("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
+ get_filename_component(arch "${dir}" NAME)
+ set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${arch}" PARENT_SCOPE)
+ break()
+ endif()
+ endforeach()
+ endif()
- ELSE(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
- MESSAGE(STATUS "Detecting ${lang} compiler ABI info - failed")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ else(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+ message(STATUS "Detecting ${lang} compiler ABI info - failed")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Detecting ${lang} compiler ABI info failed to compile with the following output:\n${OUTPUT}\n\n")
- ENDIF(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
- ENDIF(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED)
-ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ABI)
+ endif(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+ endif(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED)
+endfunction(CMAKE_DETERMINE_COMPILER_ABI)