From a2bf16d7d7258eee39a5a11220cc59ec57b1f21c Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 8 Jul 2025 13:31:17 -0400 Subject: [PATCH] Only define _LIBCPP_ENABLE_ASSERTIONS for AppleClang < 17 --- cmake/setup_compiler_flags_gnu.cmake | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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() -- 2.39.5