From cd5ea90aeefc75ac1e3a8ac8ba34f057065af2f1 Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Tue, 21 Nov 2023 14:18:58 -0700 Subject: [PATCH] Fix Xcode 15 linker warning XCode 15 includes a completely new linker implementation. Hence some flags are deprecated. The default is now error so we can simply remove the linker option. --- CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8d215ca..044168df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,9 +142,11 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") add_compile_options(-Werror=deprecated-copy) endif() - if(NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") - # Error if there's symbols that are not found at link time. - add_link_options("-Wl,--no-undefined") + if(NOT (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")) + if (NOT APPLE) + # Error if there's symbols that are not found at link time. + add_link_options("-Wl,--no-undefined") + endif() endif() elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC) add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs @@ -156,11 +158,9 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC) add_compile_options(-fno-exceptions) endif() - if(NOT (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten")) + if(NOT (CMAKE_SYSTEM_NAME MATCHES "OpenBSD|Emscripten")) # Error if there's symbols that are not found at link time. Some linkers do not support this flag. - if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - add_link_options("-Wl,-undefined,error") - elseif(NOT APPLE) + if(NOT APPLE) add_link_options("-Wl,--no-undefined") endif() endif()