From 871a0d535c635b2675138ed3a8e00436e729dbcf Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 8 Sep 2024 10:45:38 +0200 Subject: [PATCH] build: Fix building issues on macOS with clang 18 --- cmake/build_helpers.cmake | 6 ++++++ lib/third_party/jthread/includes/jthread.hpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index a3ee0a45a..a4a3b5ad4 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -582,6 +582,12 @@ macro(setupCompilerFlags target) endif () endif() + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND APPLE) + execute_process(COMMAND brew --prefix llvm OUTPUT_VARIABLE LLVM_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${LLVM_PREFIX}/lib/c++") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${LLVM_PREFIX}/lib/c++") + endif() + # Disable some warnings for gcc if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(IMHEX_C_CXX_FLAGS "${IMHEX_C_CXX_FLAGS} -Wno-restrict -Wno-stringop-overread -Wno-stringop-overflow -Wno-dangling-reference") diff --git a/lib/third_party/jthread/includes/jthread.hpp b/lib/third_party/jthread/includes/jthread.hpp index 78b23f66d..522897a75 100644 --- a/lib/third_party/jthread/includes/jthread.hpp +++ b/lib/third_party/jthread/includes/jthread.hpp @@ -3,5 +3,9 @@ #if __cpp_lib_jthread >= 201911L #include #else + #define __stop_callback_base __stop_callback_base_j + #define __stop_state __stop_state_j #include "../jthread/source/jthread.hpp" + #undef __stop_callback_base + #undef __stop_state #endif \ No newline at end of file