diff options
| author | Brad King <brad.king@kitware.com> | 2022-02-11 11:51:59 -0500 |
|---|---|---|
| committer | Brad King <brad.king@kitware.com> | 2022-02-11 11:56:58 -0500 |
| commit | 58af150a74d8da81255689dd4981aed8f45fff03 (patch) | |
| tree | 663333f8921c475f5d649764f73a52f425a666d5 /Modules/FortranCInterface | |
| parent | 847378d615edfed297a98cd662c2ebc73119d271 (diff) | |
| download | cmake-58af150a74d8da81255689dd4981aed8f45fff03.tar.gz | |
FortranCInterface: Fix mangling detection for x86_64 on arm64 macOS
Fixes: #23218
Diffstat (limited to 'Modules/FortranCInterface')
| -rw-r--r-- | Modules/FortranCInterface/Detect.cmake | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 4d3cb005a7..72e5544907 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -28,6 +28,14 @@ unset(FortranCInterface_VERIFIED_CXX CACHE) set(_result) +# Perform detection with only one architecture so that +# the info strings are not repeated. +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}") @@ -48,11 +56,13 @@ try_compile(FortranCInterface_COMPILED "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}" "-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}" + ${_FortranCInterface_OSX_ARCH} ${_FortranCInterface_EXE_LINKER_FLAGS} OUTPUT_VARIABLE FortranCInterface_OUTPUT) set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED}) unset(FortranCInterface_COMPILED CACHE) unset(_FortranCInterface_EXE_LINKER_FLAGS) +unset(_FortranCInterface_OSX_ARCH) # Locate the sample project executable. set(FortranCInterface_EXE) |
