mirror of
https://github.com/Kitware/CMake.git
synced 2026-06-30 19:57:41 +00:00
Modules/DetermineCompiler: support skipping compiler checks
Also only set F90 support detection if not set by the toolchain. As the F90 check can now be false-positive detected with any variable settings causing a success, only set it if not already defined.
This commit is contained in:
@@ -13,6 +13,42 @@ include(${CMAKE_ROOT}/Modules/CMakeParseLibraryArchitecture.cmake)
|
||||
include(CMakeTestCompilerCommon)
|
||||
|
||||
function(CMAKE_DETERMINE_COMPILER_ABI lang src)
|
||||
set(abi_variables
|
||||
CMAKE_${lang}_COMPILER_WORKS
|
||||
CMAKE_${lang}_COMPILER_ARCHITECTURE_ID
|
||||
CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES
|
||||
CMAKE_${lang}_COMPILER_LINKER
|
||||
CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES
|
||||
CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES
|
||||
CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
|
||||
CMAKE_${lang}_LIBRARY_ARCHITECTURE)
|
||||
if (CMAKE_${lang}_COMPILER_LINKER)
|
||||
list(APPEND abi_variables
|
||||
CMAKE_${lang}_COMPILER_LINKER_ID
|
||||
CMAKE_${lang}_COMPILER_LINKER_VERSION
|
||||
CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT)
|
||||
endif ()
|
||||
if (lang STREQUAL "Fortran")
|
||||
list(APPEND abi_variables
|
||||
CMAKE_${lang}_COMPILER_SUPPORTS_F90)
|
||||
endif ()
|
||||
if (lang MATCHES "^(CUDA|HIP)$")
|
||||
list(APPEND abi_variables
|
||||
CMAKE_${lang}_ARCHITECTURES
|
||||
CMAKE_${lang}_HOST_COMPILER_ID
|
||||
CMAKE_${lang}_HOST_COMPILER_VERSION
|
||||
CMAKE_${lang}_RUNTIME_LIBRARY)
|
||||
endif ()
|
||||
set(all_abi_variables_defined 1)
|
||||
foreach (abi_variable IN LISTS abi_variables)
|
||||
if (NOT DEFINED "${abi_variable}")
|
||||
set(all_abi_variables_defined 0)
|
||||
break ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
if (all_abi_variables_defined AND CMAKE_${lang}_COMPILER_WORKS)
|
||||
set(CMAKE_${lang}_ABI_COMPILED 1)
|
||||
endif ()
|
||||
if(NOT DEFINED CMAKE_${lang}_ABI_COMPILED)
|
||||
message(CHECK_START "Detecting ${lang} compiler ABI info")
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerA
|
||||
if(CMAKE_Fortran_ABI_COMPILED)
|
||||
# The compiler worked so skip dedicated test below.
|
||||
set(CMAKE_Fortran_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1)
|
||||
if (NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90)
|
||||
set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1)
|
||||
endif ()
|
||||
message(STATUS "Check for working Fortran compiler: ${CMAKE_Fortran_COMPILER} - skipped")
|
||||
else()
|
||||
cmake_determine_compiler_abi(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F)
|
||||
|
||||
Reference in New Issue
Block a user