From dbd324e3b81e3e13a7ff008ef54cd522983172ec Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Jul 2026 22:14:30 +0000 Subject: [PATCH] C++20 everywhere: set it centrally, drop the per-object overrides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Min's posttarget pins each external to C++17. Instead of overriding that per object, the root now re-forces C++20 on every target an object folder creates, right after add_subdirectory — one place. The sweep also cancels min's Apple Catch opt-out (CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS, which forces the C++20-removed std::uncaught_exception()) on any _test target, so future wrapper tests build at C++20 on macOS too. Remove the now-redundant per-object CXX_STANDARD 20 overrides. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01MRTDgYKY38WH8Bqz17W9k1 --- CMakeLists.txt | 20 +++++++++++++++++++ .../projects/mutap.aec_tilde/CMakeLists.txt | 3 --- .../projects/mutap.afc_tilde/CMakeLists.txt | 3 --- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61fa5ac..bee27f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,5 +96,25 @@ foreach (project_dir ${PROJECT_DIRS}) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/source/projects/${project_dir}/CMakeLists.txt") message("Generating: ${project_dir}") add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/source/projects/${project_dir}) + # C++20 everywhere: Min's posttarget pins each external to C++17 and the unit-test harness + # pins each _test target to C++17. Rather than override that per object, force C++20 on every + # target an object folder creates, in one place. + get_property(_proj_targets + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/source/projects/${project_dir} + PROPERTY BUILDSYSTEM_TARGETS) + foreach (_t ${_proj_targets}) + set_property(TARGET ${_t} PROPERTY CXX_STANDARD 20) + set_property(TARGET ${_t} PROPERTY CXX_STANDARD_REQUIRED ON) + # The min harness pins tests to C++17 because its bundled Catch calls + # std::uncaught_exception() — removed in C++20 (Apple's libc++ enforces it; libstdc++ still + # keeps it). On Apple it defines CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS, forcing that + # removed singular form. Now that tests are C++20, cancel that opt-out (our option comes + # later on the command line and wins) so Catch uses std::uncaught_exceptions(). + if (APPLE AND _t MATCHES "_test$") + target_compile_options(${_t} PRIVATE + -UCATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS + -DCATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + endif () + endforeach () endif () endforeach () diff --git a/source/projects/mutap.aec_tilde/CMakeLists.txt b/source/projects/mutap.aec_tilde/CMakeLists.txt index 2da4d2b..ea6e034 100644 --- a/source/projects/mutap.aec_tilde/CMakeLists.txt +++ b/source/projects/mutap.aec_tilde/CMakeLists.txt @@ -27,9 +27,6 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) -# min-posttarget pins CXX_STANDARD to 17; MuTap requires C++20. -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) - # Unit test (min-api's Catch2 harness), if the test file exists. if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}_test.cpp") include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake) diff --git a/source/projects/mutap.afc_tilde/CMakeLists.txt b/source/projects/mutap.afc_tilde/CMakeLists.txt index 1bc677e..a36b3ff 100644 --- a/source/projects/mutap.afc_tilde/CMakeLists.txt +++ b/source/projects/mutap.afc_tilde/CMakeLists.txt @@ -27,9 +27,6 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) include(${C74_MIN_API_DIR}/script/min-posttarget.cmake) -# min-posttarget pins CXX_STANDARD to 17; MuTap requires C++20. -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) - # Unit test (min-api's Catch2 harness), if the test file exists. if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}_test.cpp") include(${C74_MIN_API_DIR}/test/min-object-unittest.cmake)