summaryrefslogtreecommitdiffstats
path: root/Modules/FortranCInterface.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-02-11 16:51:59 (GMT)
committerBrad King <brad.king@kitware.com>2022-02-11 16:56:58 (GMT)
commit58af150a74d8da81255689dd4981aed8f45fff03 (patch)
tree663333f8921c475f5d649764f73a52f425a666d5 /Modules/FortranCInterface.cmake
parent847378d615edfed297a98cd662c2ebc73119d271 (diff)
downloadCMake-58af150a74d8da81255689dd4981aed8f45fff03.zip
CMake-58af150a74d8da81255689dd4981aed8f45fff03.tar.gz
CMake-58af150a74d8da81255689dd4981aed8f45fff03.tar.bz2
FortranCInterface: Fix mangling detection for x86_64 on arm64 macOS
Fixes: #23218
Diffstat (limited to 'Modules/FortranCInterface.cmake')
-rw-r--r--Modules/FortranCInterface.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index 733c723..53df01a 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -343,6 +343,14 @@ function(FortranCInterface_VERIFY)
set(_desc "Verifying Fortran/${lang} Compiler Compatibility")
message(CHECK_START "${_desc}")
+ # Perform verification with only one architecture.
+ # FIXME: Add try_compile whole-project option to forward architectures.
+ if(CMAKE_OSX_ARCHITECTURES MATCHES "^([^;]+)(;|$)")
+ set(_FortranCInterface_OSX_ARCH "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_MATCH_1}")
+ else()
+ set(_FortranCInterface_OSX_ARCH "")
+ endif()
+
cmake_policy(GET CMP0056 _FortranCInterface_CMP0056)
if(_FortranCInterface_CMP0056 STREQUAL "NEW")
set(_FortranCInterface_EXE_LINKER_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}")
@@ -365,6 +373,7 @@ function(FortranCInterface_VERIFY)
"-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
"-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}"
"-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
+ ${_FortranCInterface_OSX_ARCH}
${_FortranCInterface_EXE_LINKER_FLAGS}
OUTPUT_VARIABLE _output)
file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}")