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 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()