From 40d2842221189a7dbba728eb2bdbc7c0302fd4fd Mon Sep 17 00:00:00 2001 From: Blockost Date: Sun, 3 Aug 2025 14:48:23 -0400 Subject: [PATCH 1/2] Remove superfluous "-undefined" linker flag on macOS --- cmake/compiler/clang/settings.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake index eec7bf581a704..dfd72d945af4b 100644 --- a/cmake/compiler/clang/settings.cmake +++ b/cmake/compiler/clang/settings.cmake @@ -147,9 +147,12 @@ if(BUILD_SHARED_LIBS) INTERFACE -fvisibility=hidden) - # --no-undefined to throw errors when there are undefined symbols - # (caused through missing TRINITY_*_API macros). - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --no-undefined") + # Throw errors when there are undefined symbols (caused through missing TRINITY_*_API macros) + # This is the default behavior on macOS since clang 15. Explicitly setting this flag raises a warning + # See https://stackoverflow.com/a/77526119/3672398 + if (NOT CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --no-undefined") + endif () message(STATUS "Clang: Disallow undefined symbols") endif() From 563dc9d6f3e6f73c146bd7c8e6326878e58f88ac Mon Sep 17 00:00:00 2001 From: Blockost Date: Sun, 3 Aug 2025 14:48:55 -0400 Subject: [PATCH 2/2] Add macOS support for "nil" keyword (Sol2) --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f22642b94d47..46ad82c05da7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,9 @@ FetchContent_Declare( ) FetchContent_MakeAvailable (sol2) target_compile_definitions(sol2 INTERFACE SOL_NO_CHECK_NUMBER_PRECISION) +# Force usage of "nil" in Sol2. +# This is necessary for Apple platforms (e.g. macOS) where it considers "nil" to be a reserved keyword +target_compile_definitions(sol2 INTERFACE SOL_NO_NIL=0) # # sourcemap