From: Daniel Arndt Date: Tue, 8 Jul 2025 17:31:17 +0000 (-0400) Subject: Only define _LIBCPP_ENABLE_ASSERTIONS for AppleClang < 17 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F18641%2Fhead;p=dealii.git Only define _LIBCPP_ENABLE_ASSERTIONS for AppleClang < 17 --- diff --git a/cmake/setup_compiler_flags_gnu.cmake b/cmake/setup_compiler_flags_gnu.cmake index af05e14cee..3f768c03ea 100644 --- a/cmake/setup_compiler_flags_gnu.cmake +++ b/cmake/setup_compiler_flags_gnu.cmake @@ -192,10 +192,16 @@ if (CMAKE_BUILD_TYPE MATCHES "Debug") # Enable invalid element access and other checks in the c++ standard library: list(APPEND DEAL_II_DEFINITIONS_DEBUG "_GLIBCXX_ASSERTIONS") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) - # _LIBCPP_ENABLE_ASSERTIONS was deprecated in clang++-19 - # _LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE should be used instead - list(APPEND DEAL_II_DEFINITIONS_DEBUG "_LIBCPP_ENABLE_ASSERTIONS") + # _LIBCPP_ENABLE_ASSERTIONS was deprecated in clang++-19 + # _LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE should be used instead + if (CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) + list(APPEND DEAL_II_DEFINITIONS_DEBUG "_LIBCPP_ENABLE_ASSERTIONS") + endif() + else() + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) + list(APPEND DEAL_II_DEFINITIONS_DEBUG "_LIBCPP_ENABLE_ASSERTIONS") + endif() endif() list(APPEND DEAL_II_DEFINITIONS_DEBUG "_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE") endif()