diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCompilerABI.cmake | 5 | ||||
-rw-r--r-- | Modules/CMakeTestCCompiler.cmake | 75 | ||||
-rw-r--r-- | Modules/CMakeTestCUDACompiler.cmake | 102 | ||||
-rw-r--r-- | Modules/CMakeTestCXXCompiler.cmake | 75 | ||||
-rw-r--r-- | Modules/CMakeTestFortranCompiler.cmake | 118 | ||||
-rw-r--r-- | Modules/CMakeTestOBJCCompiler.cmake | 75 | ||||
-rw-r--r-- | Modules/CMakeTestOBJCXXCompiler.cmake | 75 |
7 files changed, 266 insertions, 259 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index e1b3c52..50d5cd1 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -65,10 +65,13 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) # Move result from cache to normal variable. set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED}) unset(CMAKE_${lang}_ABI_COMPILED CACHE) + if(CMAKE_${lang}_ABI_COMPILED AND _copy_error) + set(CMAKE_${lang}_ABI_COMPILED 0) + endif() set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED} PARENT_SCOPE) # Load the resulting information strings. - if(CMAKE_${lang}_ABI_COMPILED AND NOT _copy_error) + if(CMAKE_${lang}_ABI_COMPILED) message(CHECK_PASS "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") diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index eadea89..3734ec4 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -21,6 +21,15 @@ endif() # We now store this in CMakeCCompiler.cmake. unset(CMAKE_C_COMPILER_WORKS CACHE) +# Try to identify the ABI and configure it into CMakeCCompiler.cmake +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) +CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c) +if(CMAKE_C_ABI_COMPILED) + # The compiler worked so skip dedicated test below. + set(CMAKE_C_COMPILER_WORKS TRUE) + message(STATUS "Check for working C compiler: ${CMAKE_C_COMPILER} - skipped") +endif() + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected C compiler can actually compile # and link the most basic of programs. If not, a fatal error @@ -47,49 +56,41 @@ if(NOT CMAKE_C_COMPILER_WORKS) # Move result from cache to normal variable. set(CMAKE_C_COMPILER_WORKS ${CMAKE_C_COMPILER_WORKS}) unset(CMAKE_C_COMPILER_WORKS CACHE) - set(C_TEST_WAS_RUN 1) __TestCompiler_restoreTryCompileTargetType() -endif() - -if(NOT CMAKE_C_COMPILER_WORKS) - PrintTestCompilerResult(CHECK_FAIL "broken") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the C compiler works failed with " - "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n") - string(REPLACE "\n" "\n " _output "${__CMAKE_C_COMPILER_OUTPUT}") - message(FATAL_ERROR "The C compiler\n \"${CMAKE_C_COMPILER}\"\n" - "is not able to compile a simple test program.\nIt fails " - "with the following output:\n ${_output}\n\n" - "CMake will not be able to correctly generate this project.") -else() - if(C_TEST_WAS_RUN) - PrintTestCompilerResult(CHECK_PASS "works") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the C compiler works passed with " + if(NOT CMAKE_C_COMPILER_WORKS) + PrintTestCompilerResult(CHECK_FAIL "broken") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the C compiler works failed with " "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n") + string(REPLACE "\n" "\n " _output "${__CMAKE_C_COMPILER_OUTPUT}") + message(FATAL_ERROR "The C compiler\n \"${CMAKE_C_COMPILER}\"\n" + "is not able to compile a simple test program.\nIt fails " + "with the following output:\n ${_output}\n\n" + "CMake will not be able to correctly generate this project.") endif() + PrintTestCompilerResult(CHECK_PASS "works") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the C compiler works passed with " + "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n") +endif() - # Try to identify the ABI and configure it into CMakeCCompiler.cmake - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c) - # Try to identify the compiler features - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) - CMAKE_DETERMINE_COMPILE_FEATURES(C) +# Try to identify the compiler features +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) +CMAKE_DETERMINE_COMPILE_FEATURES(C) - # Re-configure to save learned information. - configure_file( - ${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake - @ONLY - ) - include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake) +# Re-configure to save learned information. +configure_file( + ${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake + @ONLY + ) +include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake) - if(CMAKE_C_SIZEOF_DATA_PTR) - foreach(f ${CMAKE_C_ABI_FILES}) - include(${f}) - endforeach() - unset(CMAKE_C_ABI_FILES) - endif() +if(CMAKE_C_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_C_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_C_ABI_FILES) endif() set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE}) diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake index 6d39d3e..a18947b 100644 --- a/Modules/CMakeTestCUDACompiler.cmake +++ b/Modules/CMakeTestCUDACompiler.cmake @@ -14,6 +14,15 @@ include(CMakeTestCompilerCommon) # We now store this in CMakeCUDACompiler.cmake. unset(CMAKE_CUDA_COMPILER_WORKS CACHE) +# Try to identify the ABI and configure it into CMakeCUDACompiler.cmake +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) +CMAKE_DETERMINE_COMPILER_ABI(CUDA ${CMAKE_ROOT}/Modules/CMakeCUDACompilerABI.cu) +if(CMAKE_CUDA_ABI_COMPILED) + # The compiler worked so skip dedicated test below. + set(CMAKE_CUDA_COMPILER_WORKS TRUE) + message(STATUS "Check for working CUDA compiler: ${CMAKE_CUDA_COMPILER} - skipped") +endif() + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that the selected cuda compiler can actually compile # and link the most basic of programs. If not, a fatal error @@ -34,65 +43,56 @@ if(NOT CMAKE_CUDA_COMPILER_WORKS) # Move result from cache to normal variable. set(CMAKE_CUDA_COMPILER_WORKS ${CMAKE_CUDA_COMPILER_WORKS}) unset(CMAKE_CUDA_COMPILER_WORKS CACHE) - set(CUDA_TEST_WAS_RUN 1) -endif() - -if(NOT CMAKE_CUDA_COMPILER_WORKS) - PrintTestCompilerResult(CHECK_FAIL "broken") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the CUDA compiler works failed with " - "the following output:\n${__CMAKE_CUDA_COMPILER_OUTPUT}\n\n") - string(REPLACE "\n" "\n " _output "${__CMAKE_CUDA_COMPILER_OUTPUT}") - message(FATAL_ERROR "The CUDA compiler\n \"${CMAKE_CUDA_COMPILER}\"\n" - "is not able to compile a simple test program.\nIt fails " - "with the following output:\n ${_output}\n\n" - "CMake will not be able to correctly generate this project.") -else() - if(CUDA_TEST_WAS_RUN) - PrintTestCompilerResult(CHECK_PASS "works") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the CUDA compiler works passed with " + if(NOT CMAKE_CUDA_COMPILER_WORKS) + PrintTestCompilerResult(CHECK_FAIL "broken") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the CUDA compiler works failed with " "the following output:\n${__CMAKE_CUDA_COMPILER_OUTPUT}\n\n") + string(REPLACE "\n" "\n " _output "${__CMAKE_CUDA_COMPILER_OUTPUT}") + message(FATAL_ERROR "The CUDA compiler\n \"${CMAKE_CUDA_COMPILER}\"\n" + "is not able to compile a simple test program.\nIt fails " + "with the following output:\n ${_output}\n\n" + "CMake will not be able to correctly generate this project.") endif() + PrintTestCompilerResult(CHECK_PASS "works") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the CUDA compiler works passed with " + "the following output:\n${__CMAKE_CUDA_COMPILER_OUTPUT}\n\n") +endif() - # Try to identify the ABI and configure it into CMakeCUDACompiler.cmake - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(CUDA ${CMAKE_ROOT}/Modules/CMakeCUDACompilerABI.cu) - # Try to identify the compiler features - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) - CMAKE_DETERMINE_COMPILE_FEATURES(CUDA) +# Try to identify the compiler features +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) +CMAKE_DETERMINE_COMPILE_FEATURES(CUDA) - if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") - set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}") - set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}") - endif() +if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") + set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}") + set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}") +endif() - # Filter out implicit link libraries that should not be passed unconditionally. - # See CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE in CMakeDetermineCUDACompiler. - list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES ${CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE}) +# Filter out implicit link libraries that should not be passed unconditionally. +# See CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE in CMakeDetermineCUDACompiler. +list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES ${CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE}) - if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") - # Remove the CUDA Toolkit include directories from the set of - # implicit system include directories. - # This resolves the issue that NVCC doesn't specify these - # includes as SYSTEM includes when compiling device code, and sometimes - # they contain headers that generate warnings, so let users mark them - # as SYSTEM explicitly - if(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES) - list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES - ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} - ) - endif() +if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") + # Remove the CUDA Toolkit include directories from the set of + # implicit system include directories. + # This resolves the issue that NVCC doesn't specify these + # includes as SYSTEM includes when compiling device code, and sometimes + # they contain headers that generate warnings, so let users mark them + # as SYSTEM explicitly + if(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES) + list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES + ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} + ) endif() - - # Re-configure to save learned information. - configure_file( - ${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake - @ONLY - ) - include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake) endif() +# Re-configure to save learned information. +configure_file( + ${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake + @ONLY + ) +include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake) unset(__CMAKE_CUDA_COMPILER_OUTPUT) diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index bd42153..b9cb1dd 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -21,6 +21,15 @@ endif() # We now store this in CMakeCXXCompiler.cmake. unset(CMAKE_CXX_COMPILER_WORKS CACHE) +# Try to identify the ABI and configure it into CMakeCXXCompiler.cmake +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) +CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp) +if(CMAKE_CXX_ABI_COMPILED) + # The compiler worked so skip dedicated test below. + set(CMAKE_CXX_COMPILER_WORKS TRUE) + message(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER} - skipped") +endif() + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that the selected C++ compiler can actually compile # and link the most basic of programs. If not, a fatal error @@ -40,49 +49,41 @@ if(NOT CMAKE_CXX_COMPILER_WORKS) # Move result from cache to normal variable. set(CMAKE_CXX_COMPILER_WORKS ${CMAKE_CXX_COMPILER_WORKS}) unset(CMAKE_CXX_COMPILER_WORKS CACHE) - set(CXX_TEST_WAS_RUN 1) __TestCompiler_restoreTryCompileTargetType() -endif() - -if(NOT CMAKE_CXX_COMPILER_WORKS) - PrintTestCompilerResult(CHECK_FAIL "broken") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the CXX compiler works failed with " - "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") - string(REPLACE "\n" "\n " _output "${__CMAKE_CXX_COMPILER_OUTPUT}") - message(FATAL_ERROR "The C++ compiler\n \"${CMAKE_CXX_COMPILER}\"\n" - "is not able to compile a simple test program.\nIt fails " - "with the following output:\n ${_output}\n\n" - "CMake will not be able to correctly generate this project.") -else() - if(CXX_TEST_WAS_RUN) - PrintTestCompilerResult(CHECK_PASS "works") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the CXX compiler works passed with " + if(NOT CMAKE_CXX_COMPILER_WORKS) + PrintTestCompilerResult(CHECK_FAIL "broken") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the CXX compiler works failed with " "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") + string(REPLACE "\n" "\n " _output "${__CMAKE_CXX_COMPILER_OUTPUT}") + message(FATAL_ERROR "The C++ compiler\n \"${CMAKE_CXX_COMPILER}\"\n" + "is not able to compile a simple test program.\nIt fails " + "with the following output:\n ${_output}\n\n" + "CMake will not be able to correctly generate this project.") endif() + PrintTestCompilerResult(CHECK_PASS "works") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the CXX compiler works passed with " + "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") +endif() - # Try to identify the ABI and configure it into CMakeCXXCompiler.cmake - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp) - # Try to identify the compiler features - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) - CMAKE_DETERMINE_COMPILE_FEATURES(CXX) +# Try to identify the compiler features +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) +CMAKE_DETERMINE_COMPILE_FEATURES(CXX) - # Re-configure to save learned information. - configure_file( - ${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake - @ONLY - ) - include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake) +# Re-configure to save learned information. +configure_file( + ${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake + @ONLY + ) +include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake) - if(CMAKE_CXX_SIZEOF_DATA_PTR) - foreach(f ${CMAKE_CXX_ABI_FILES}) - include(${f}) - endforeach() - unset(CMAKE_CXX_ABI_FILES) - endif() +if(CMAKE_CXX_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_CXX_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_CXX_ABI_FILES) endif() set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE}) diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index 7461f9c..10fb0a7 100644 --- a/Modules/CMakeTestFortranCompiler.cmake +++ b/Modules/CMakeTestFortranCompiler.cmake @@ -15,6 +15,15 @@ include(CMakeTestCompilerCommon) # We now store this in CMakeFortranCompiler.cmake. unset(CMAKE_Fortran_COMPILER_WORKS CACHE) +# Try to identify the ABI and configure it into CMakeFortranCompiler.cmake +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) +CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F) +if(CMAKE_Fortran_ABI_COMPILED) + # The compiler worked so skip dedicated test below. + set(CMAKE_Fortran_COMPILER_WORKS TRUE) + message(STATUS "Check for working Fortran compiler: ${CMAKE_Fortran_COMPILER} - skipped") +endif() + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that the selected Fortran compiler can actually compile # and link the most basic of programs. If not, a fatal error @@ -33,70 +42,61 @@ if(NOT CMAKE_Fortran_COMPILER_WORKS) # Move result from cache to normal variable. set(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_Fortran_COMPILER_WORKS}) unset(CMAKE_Fortran_COMPILER_WORKS CACHE) - set(FORTRAN_TEST_WAS_RUN 1) -endif() - -if(NOT CMAKE_Fortran_COMPILER_WORKS) - PrintTestCompilerResult(CHECK_FAIL "broken") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran compiler works failed with " - "the following output:\n${OUTPUT}\n\n") - string(REPLACE "\n" "\n " _output "${OUTPUT}") - message(FATAL_ERROR "The Fortran compiler\n \"${CMAKE_Fortran_COMPILER}\"\n" - "is not able to compile a simple test program.\nIt fails " - "with the following output:\n ${_output}\n\n" - "CMake will not be able to correctly generate this project.") -else() - if(FORTRAN_TEST_WAS_RUN) - PrintTestCompilerResult(CHECK_PASS "works") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran compiler works passed with " + if(NOT CMAKE_Fortran_COMPILER_WORKS) + PrintTestCompilerResult(CHECK_FAIL "broken") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran compiler works failed with " "the following output:\n${OUTPUT}\n\n") + string(REPLACE "\n" "\n " _output "${OUTPUT}") + message(FATAL_ERROR "The Fortran compiler\n \"${CMAKE_Fortran_COMPILER}\"\n" + "is not able to compile a simple test program.\nIt fails " + "with the following output:\n ${_output}\n\n" + "CMake will not be able to correctly generate this project.") endif() + PrintTestCompilerResult(CHECK_PASS "works") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran compiler works passed with " + "the following output:\n${OUTPUT}\n\n") +endif() - # Try to identify the ABI and configure it into CMakeFortranCompiler.cmake - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F) - - # Test for Fortran 90 support by using an f90-specific construct. - if(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90) - message(CHECK_START "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90") - file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 " - PROGRAM TESTFortran90 - integer stop ; stop = 1 ; do while ( stop .eq. 0 ) ; end do - END PROGRAM TESTFortran90 +# Test for Fortran 90 support by using an f90-specific construct. +if(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90) + message(CHECK_START "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90") + file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 " + PROGRAM TESTFortran90 + integer stop ; stop = 1 ; do while ( stop .eq. 0 ) ; end do + END PROGRAM TESTFortran90 ") - try_compile(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 - OUTPUT_VARIABLE OUTPUT) - if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - message(CHECK_PASS "yes") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran compiler supports Fortran 90 passed with " - "the following output:\n${OUTPUT}\n\n") - set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1) - else() - message(CHECK_FAIL "no") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran compiler supports Fortran 90 failed with " - "the following output:\n${OUTPUT}\n\n") - set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 0) - endif() - unset(CMAKE_Fortran_COMPILER_SUPPORTS_F90 CACHE) + try_compile(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 + OUTPUT_VARIABLE OUTPUT) + if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + message(CHECK_PASS "yes") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran compiler supports Fortran 90 passed with " + "the following output:\n${OUTPUT}\n\n") + set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1) + else() + message(CHECK_FAIL "no") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran compiler supports Fortran 90 failed with " + "the following output:\n${OUTPUT}\n\n") + set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 0) endif() + unset(CMAKE_Fortran_COMPILER_SUPPORTS_F90 CACHE) +endif() - # Re-configure to save learned information. - configure_file( - ${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake - @ONLY - ) - include(${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake) +# Re-configure to save learned information. +configure_file( + ${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake + @ONLY + ) +include(${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake) - if(CMAKE_Fortran_SIZEOF_DATA_PTR) - foreach(f ${CMAKE_Fortran_ABI_FILES}) - include(${f}) - endforeach() - unset(CMAKE_Fortran_ABI_FILES) - endif() +if(CMAKE_Fortran_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_Fortran_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_Fortran_ABI_FILES) endif() diff --git a/Modules/CMakeTestOBJCCompiler.cmake b/Modules/CMakeTestOBJCCompiler.cmake index bcc6fae..0e333c0 100644 --- a/Modules/CMakeTestOBJCCompiler.cmake +++ b/Modules/CMakeTestOBJCCompiler.cmake @@ -21,6 +21,15 @@ endif() # We now store this in CMakeCCompiler.cmake. unset(CMAKE_OBJC_COMPILER_WORKS CACHE) +# Try to identify the ABI and configure it into CMakeOBJCCompiler.cmake +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) +CMAKE_DETERMINE_COMPILER_ABI(OBJC ${CMAKE_ROOT}/Modules/CMakeOBJCCompilerABI.m) +if(CMAKE_OBJC_ABI_COMPILED) + # The compiler worked so skip dedicated test below. + set(CMAKE_OBJC_COMPILER_WORKS TRUE) + message(STATUS "Check for working OBJC compiler: ${CMAKE_OBJC_COMPILER} - skipped") +endif() + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected Objective-C compiler can actually compile # and link the most basic of programs. If not, a fatal error @@ -44,49 +53,41 @@ if(NOT CMAKE_OBJC_COMPILER_WORKS) # Move result from cache to normal variable. set(CMAKE_OBJC_COMPILER_WORKS ${CMAKE_OBJC_COMPILER_WORKS}) unset(CMAKE_OBJC_COMPILER_WORKS CACHE) - set(OBJC_TEST_WAS_RUN 1) __TestCompiler_restoreTryCompileTargetType() -endif() - -if(NOT CMAKE_OBJC_COMPILER_WORKS) - PrintTestCompilerResult(CHECK_FAIL "broken") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Objective-C compiler works failed with " - "the following output:\n${__CMAKE_OBJC_COMPILER_OUTPUT}\n\n") - string(REPLACE "\n" "\n " _output "${__CMAKE_OBJC_COMPILER_OUTPUT}") - message(FATAL_ERROR "The Objective-C compiler\n \"${CMAKE_OBJC_COMPILER}\"\n" - "is not able to compile a simple test program.\nIt fails " - "with the following output:\n ${_output}\n\n" - "CMake will not be able to correctly generate this project.") -else() - if(OBJC_TEST_WAS_RUN) - PrintTestCompilerResult(CHECK_PASS "works") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Objective-C compiler works passed with " + if(NOT CMAKE_OBJC_COMPILER_WORKS) + PrintTestCompilerResult(CHECK_FAIL "broken") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Objective-C compiler works failed with " "the following output:\n${__CMAKE_OBJC_COMPILER_OUTPUT}\n\n") + string(REPLACE "\n" "\n " _output "${__CMAKE_OBJC_COMPILER_OUTPUT}") + message(FATAL_ERROR "The Objective-C compiler\n \"${CMAKE_OBJC_COMPILER}\"\n" + "is not able to compile a simple test program.\nIt fails " + "with the following output:\n ${_output}\n\n" + "CMake will not be able to correctly generate this project.") endif() + PrintTestCompilerResult(CHECK_PASS "works") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Objective-C compiler works passed with " + "the following output:\n${__CMAKE_OBJC_COMPILER_OUTPUT}\n\n") +endif() - # Try to identify the ABI and configure it into CMakeOBJCCompiler.cmake - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(OBJC ${CMAKE_ROOT}/Modules/CMakeOBJCCompilerABI.m) - # Try to identify the compiler features - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) - CMAKE_DETERMINE_COMPILE_FEATURES(OBJC) +# Try to identify the compiler features +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) +CMAKE_DETERMINE_COMPILE_FEATURES(OBJC) - # Re-configure to save learned information. - configure_file( - ${CMAKE_ROOT}/Modules/CMakeOBJCCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCCompiler.cmake - @ONLY - ) - include(${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCCompiler.cmake) +# Re-configure to save learned information. +configure_file( + ${CMAKE_ROOT}/Modules/CMakeOBJCCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCCompiler.cmake + @ONLY + ) +include(${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCCompiler.cmake) - if(CMAKE_OBJC_SIZEOF_DATA_PTR) - foreach(f ${CMAKE_OBJC_ABI_FILES}) - include(${f}) - endforeach() - unset(CMAKE_OBJC_ABI_FILES) - endif() +if(CMAKE_OBJC_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_OBJC_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_OBJC_ABI_FILES) endif() set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE}) diff --git a/Modules/CMakeTestOBJCXXCompiler.cmake b/Modules/CMakeTestOBJCXXCompiler.cmake index 83227d5..dc153a7 100644 --- a/Modules/CMakeTestOBJCXXCompiler.cmake +++ b/Modules/CMakeTestOBJCXXCompiler.cmake @@ -21,6 +21,15 @@ endif() # We now store this in CMakeOBJCXXCompiler.cmake. unset(CMAKE_OBJCXX_COMPILER_WORKS CACHE) +# Try to identify the ABI and configure it into CMakeOBJCXXCompiler.cmake +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) +CMAKE_DETERMINE_COMPILER_ABI(OBJCXX ${CMAKE_ROOT}/Modules/CMakeOBJCXXCompilerABI.mm) +if(CMAKE_OBJCXX_ABI_COMPILED) + # The compiler worked so skip dedicated test below. + set(CMAKE_OBJCXX_COMPILER_WORKS TRUE) + message(STATUS "Check for working OBJCXX compiler: ${CMAKE_OBJCXX_COMPILER} - skipped") +endif() + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that the selected Objective-C++ compiler can actually compile # and link the most basic of programs. If not, a fatal error @@ -43,49 +52,41 @@ if(NOT CMAKE_OBJCXX_COMPILER_WORKS) # Move result from cache to normal variable. set(CMAKE_OBJCXX_COMPILER_WORKS ${CMAKE_OBJCXX_COMPILER_WORKS}) unset(CMAKE_OBJCXX_COMPILER_WORKS CACHE) - set(OBJCXX_TEST_WAS_RUN 1) __TestCompiler_restoreTryCompileTargetType() -endif() - -if(NOT CMAKE_OBJCXX_COMPILER_WORKS) - PrintTestCompilerResult(CHECK_FAIL "broken") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Objective-C++ compiler works failed with " - "the following output:\n${__CMAKE_OBJCXX_COMPILER_OUTPUT}\n\n") - string(REPLACE "\n" "\n " _output "${__CMAKE_OBJCXX_COMPILER_OUTPUT}") - message(FATAL_ERROR "The Objective-C++ compiler\n \"${CMAKE_OBJCXX_COMPILER}\"\n" - "is not able to compile a simple test program.\nIt fails " - "with the following output:\n ${_output}\n\n" - "CMake will not be able to correctly generate this project.") -else() - if(OBJCXX_TEST_WAS_RUN) - PrintTestCompilerResult(CHECK_PASS "works") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Objective-C++ compiler works passed with " + if(NOT CMAKE_OBJCXX_COMPILER_WORKS) + PrintTestCompilerResult(CHECK_FAIL "broken") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Objective-C++ compiler works failed with " "the following output:\n${__CMAKE_OBJCXX_COMPILER_OUTPUT}\n\n") + string(REPLACE "\n" "\n " _output "${__CMAKE_OBJCXX_COMPILER_OUTPUT}") + message(FATAL_ERROR "The Objective-C++ compiler\n \"${CMAKE_OBJCXX_COMPILER}\"\n" + "is not able to compile a simple test program.\nIt fails " + "with the following output:\n ${_output}\n\n" + "CMake will not be able to correctly generate this project.") endif() + PrintTestCompilerResult(CHECK_PASS "works") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Objective-C++ compiler works passed with " + "the following output:\n${__CMAKE_OBJCXX_COMPILER_OUTPUT}\n\n") +endif() - # Try to identify the ABI and configure it into CMakeOBJCXXCompiler.cmake - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(OBJCXX ${CMAKE_ROOT}/Modules/CMakeOBJCXXCompilerABI.mm) - # Try to identify the compiler features - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) - CMAKE_DETERMINE_COMPILE_FEATURES(OBJCXX) +# Try to identify the compiler features +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake) +CMAKE_DETERMINE_COMPILE_FEATURES(OBJCXX) - # Re-configure to save learned information. - configure_file( - ${CMAKE_ROOT}/Modules/CMakeOBJCXXCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCXXCompiler.cmake - @ONLY - ) - include(${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCXXCompiler.cmake) +# Re-configure to save learned information. +configure_file( + ${CMAKE_ROOT}/Modules/CMakeOBJCXXCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCXXCompiler.cmake + @ONLY + ) +include(${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCXXCompiler.cmake) - if(CMAKE_OBJCXX_SIZEOF_DATA_PTR) - foreach(f ${CMAKE_OBJCXX_ABI_FILES}) - include(${f}) - endforeach() - unset(CMAKE_OBJCXX_ABI_FILES) - endif() +if(CMAKE_OBJCXX_SIZEOF_DATA_PTR) + foreach(f ${CMAKE_OBJCXX_ABI_FILES}) + include(${f}) + endforeach() + unset(CMAKE_OBJCXX_ABI_FILES) endif() set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE}) |