Skip to content

Commit ecfe6be

Browse files
committed
CMakeLists: include AppleClang in the precompile-header workaround gate
`CMAKE_CXX_COMPILER_ID STREQUAL "Clang"` only matches upstream LLVM clang -- AppleClang's compiler id is "AppleClang", so the precompile header that pulls in `clang.hpp` was never being applied to fastmcpp_core's own translation units under AppleClang. Since fastmcpp_core is a STATIC library, its .o files (compiled without the workaround) get linked into consumer dylibs. That brought the unguarded `__from_native_exception_pointer` reference into downstream binaries built with AppleClang regardless of what clang.hpp did in the consumer's own sources. Switch the gate to `MATCHES "^(Apple)?Clang$"` so both compiler ids qualify.
1 parent 7e266a6 commit ecfe6be

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ if(MSVC)
7272
endif()
7373

7474
# inject work-around for Clang libc++ and older Xcode versions' compatibility
75-
if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
75+
# AppleClang's CMAKE_CXX_COMPILER_ID is "AppleClang", not "Clang" -- match both so
76+
# fastmcpp_core's own translation units pick up the override and don't drag the
77+
# unguarded `__from_native_exception_pointer` reference into static linkers' output.
78+
if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
7679
target_precompile_headers(fastmcpp_core
7780
PRIVATE
7881
$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/include/fastmcpp/clang.hpp>

0 commit comments

Comments
 (0)