cxx: only set GLIBCXX_DEBUG if using libstdc++
Some libraries detect the debug mode of the stdlib and try to integrate with the system headers (eg, range-v3) which obviously doesn't work well if we're using an alternative stdlib like clang's libc++.
This commit is contained in:
parent
4aa60cc306
commit
f269ef3f4f
1
nc.cmake
1
nc.cmake
@ -13,6 +13,7 @@ set (THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package (Threads REQUIRED)
|
||||
link_libraries (Threads::Threads)
|
||||
|
||||
# cxx.cmake must be imported first
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/nc_cxx.cmake")
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/nc_sanitizer.cmake")
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/nc_platform.cmake")
|
||||
|
13
nc_cxx.cmake
13
nc_cxx.cmake
@ -32,16 +32,19 @@ append_compile_flag ("/std:c++latest")
|
||||
|
||||
|
||||
###############################################################################
|
||||
set(STDLIB "libc++" CACHE STRING "Which stdlib to specify for Clang")
|
||||
# STDLIB must be set after this block.
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(STDLIB "libc++")
|
||||
append_compile_flag ("-stdlib=${STDLIB}")
|
||||
append_link_flag ("-fuse-ld=lld")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(STDLIB "libstdc++")
|
||||
append_link_flag ("-fuse-ld=gold")
|
||||
endif ()
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
|
||||
|
||||
###############################################################################
|
||||
# find the gcc or clang filesystem library and append to libs if needed
|
||||
|
@ -192,7 +192,9 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_definitions(-DENABLE_DEBUGGING)
|
||||
|
||||
if (RUNTIME_DEBUGGING)
|
||||
add_definitions(-D_GLIBCXX_DEBUG)
|
||||
if ("${STDLIB}" STREQUAL "libstdc++")
|
||||
add_definitions(-D_GLIBCXX_DEBUG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Don't make any commits that use -O0 by default. Instead, either add an
|
||||
|
Loading…
Reference in New Issue
Block a user