@@ -8,26 +8,30 @@ if(MSVC)
88 add_definitions (-DWIN32_LEAN_MEAN )
99endif ()
1010
11- # TODO: this should probably apply to the compiler and not the platform - I think it is only "broken" with MinGW
12- # TODO: AppleClang only has libc++
13- # TODO: what about clang-cl and native Win32 clang?
14- if (CPPCHK_GLIBCXX_DEBUG AND UNIX AND CMAKE_BUILD_TYPE STREQUAL "Debug" )
15- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
16- if (USE_LIBCXX)
17- if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 18)
18- add_definitions (-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG )
19- else ()
20- add_definitions (-D_LIBCPP_ENABLE_ASSERTIONS=1 )
21- endif ()
22- # TODO: also add _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS?
11+ # libstdc++-specific flags
12+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR (NOT USE_LIBCXX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang" ))
13+ if (CPPCHK_GLIBCXX_DEBUG AND CMAKE_BUILD_TYPE STREQUAL "Debug" )
14+ add_definitions (-D_GLIBCXX_DEBUG )
15+ endif ()
16+ endif ()
17+
18+ # TODO: what about clang-cl?
19+ # libc++-specific flags - AppleClang only has libc++
20+ if ((USE_LIBCXX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
21+ if (CPPCHK_GLIBCXX_DEBUG AND CMAKE_BUILD_TYPE STREQUAL "Debug" )
22+ # TODO: determine proper version for AppleClang - current value is based on the oldest version avaialble in CI
23+ if ((CMAKE_CXX_COMPILER_ID STREQUALS "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 18) OR
24+ (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17))
25+ add_definitions (-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG )
26+ else ()
27+ add_definitions (-D_LIBCPP_ENABLE_ASSERTIONS=1 )
2328 endif ()
29+ # TODO: also add _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS?
2430 else ()
2531 # TODO: check if this can be enabled again for Clang - also done in Makefile
2632 add_definitions (-D_GLIBCXX_DEBUG )
2733 endif ()
28- endif ()
2934
30- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND USE_LIBCXX)
3135 add_definitions (-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES )
3236endif ()
3337
0 commit comments