Skip to content

Commit 25e57d0

Browse files
committed
Avoid googletest include cxxabi.h as it conflicts with libstdc++
See llvm/llvm-project#121300
1 parent 2c3d9dd commit 25e57d0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ endfunction()
7777

7878
if(${SUBSPACE_BUILD_TESTS} OR ${SUBSPACE_BUILD_BENCHMARKS})
7979
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
80+
# Prevent googletest from including libc++abi's cxxabi.h, since it has a
81+
# conflicting declaration of the __cxa_init_primary_exception symbol with
82+
# libstdc++. It's very unclear why googletest unconditionally includes this
83+
# header when the build is not set up to use libc++abi otherwise. We could
84+
# add detection here to keep it when using libc++abi but we currently
85+
# don't. See https://github.com/llvm/llvm-project/issues/121300
86+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_CXXABI_H_=0")
8087
add_subdirectory(third_party/googletest)
8188
include(GoogleTest)
8289
enable_testing()

0 commit comments

Comments
 (0)