From 9df2d90e47560b7940a11236ebfe3e6831104ff9 Mon Sep 17 00:00:00 2001 From: Oliver Hahn Date: Tue, 19 Mar 2024 17:38:46 +0100 Subject: [PATCH] added additional linker options for newer versions of MacOS to re-enable C++ exceptions and prevent possible linker problems --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69dce44..1e091ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -310,3 +310,13 @@ if(ENABLE_GENERICIO) target_link_libraries(${PRGNAME} PRIVATE genericio::genericio_mpi) target_compile_definitions(${PRGNAME} PRIVATE "ENABLE_GENERICIO") endif() + +######################################################################################################################## +# CPU specifics +if(APPLE) + # prevent linking problems on recent MacOS, enable exceptions (disabled otherwise) + target_link_options(${PRGNAME} PRIVATE "-fexceptions" "-Wl,-no_warn_duplicate_libraries,-ld_classic" ) + set(EXE_LINKER_FLAGS "${EXE_LINKER_FLAGS} -Wl,-keep_dwarf_unwind") + set(SHARED_LINKER_FLAGS "${SHARED_LINKER_FLAGS} -Wl,-keep_dwarf_unwind") + set(MODULE_LINKER_FLAGS "${MODULE_LINKER_FLAGS} -Wl,-keep_dwarf_unwind") +endif()