From edf461865a7cbf2804f81a35bf2adfa838d52829 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 19 Jul 2026 13:20:47 +0000 Subject: [PATCH 25/71] fix(macos): control the frontend ObjC++ -std via a target flag, not COMPILE_OPTIONS With the Portfile no longer forcing a global -std for ObjC++, CMake's global CMAKE_OBJCXX_STANDARD=23 would otherwise apply to the frontend .mm files too. Disable CMake's standard-flag injection for the contour target and pass the frontend -std (default gnu++98) explicitly, guarded to the OBJCXX language. This keeps the engine's coretext_locator.mm at C++23 while the frontend .mm files build at gnu++98, and works with gcc-4.2 (which predates CMake's OBJCXX_STANDARD). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01AeG2jwYMX5gdvvtUnx3PJa --- src/contour_macos/CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/contour_macos/CMakeLists.txt b/src/contour_macos/CMakeLists.txt index ebd82c59..bbee6339 100644 --- a/src/contour_macos/CMakeLists.txt +++ b/src/contour_macos/CMakeLists.txt @@ -80,10 +80,15 @@ if(APPLE) target_link_libraries(contour PRIVATE contour_macos) target_compile_options(contour PRIVATE ${_contour_macos_warn_opts}) - # Force the ObjC++ standard explicitly (works even with gcc-4.2, which predates CMake's - # OBJCXX_STANDARD handling), and leave the target's plain C++ standard unset (no C++ TUs). - set_source_files_properties(${_app_sources} PROPERTIES - COMPILE_OPTIONS "-std=${CONTOUR_MACOS_OBJCXX_STD}") + # This target's .mm files build at a lower C++ standard than the C++23 engine. Turn off + # CMake's own standard-flag injection for the target (so it does not emit a competing + # -std from the global CMAKE_OBJCXX_STANDARD=23) and set the exact -std ourselves. Doing + # it via a flag rather than the OBJCXX_STANDARD property also works with gcc-4.2, which + # predates CMake's OBJCXX_STANDARD handling. + set_target_properties(contour PROPERTIES + OBJCXX_STANDARD "" + OBJCXX_STANDARD_REQUIRED OFF) + target_compile_options(contour PRIVATE $<$:-std=${CONTOUR_MACOS_OBJCXX_STD}>) # CoreGraphics is not a standalone linkable framework on 10.6 (like CoreText); its # symbols come via ApplicationServices. Link ApplicationServices, not CoreGraphics.