From 7fdf6823f518d7caa601a178f60bce6a718fc0f3 Mon Sep 17 00:00:00 2001 From: afiqzudinhadi Date: Mon, 22 Jun 2026 22:30:31 +0800 Subject: [PATCH] Fix C++ standard: use zephyr_library to override Zephyr's -std=c++11 with gnu++23 --- CMakeLists.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 992bb78..742e76e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,14 +179,23 @@ if(CONFIG_ZMK_JAVELIN_STENO) ${ZMK_INIT_SRC} ) - # C++ flags + Javelin compile definitions - set_source_files_properties(${ALL_CXX_SRC} PROPERTIES - COMPILE_FLAGS "-std=gnu++23 -fno-exceptions -fno-rtti -fno-threadsafe-statics" - COMPILE_DEFINITIONS "JAVELIN_USE_EMBEDDED_STENO=1;JAVELIN_USE_USER_DICTIONARY=1;JAVELIN_PLATFORM_ZEPHYR=1" + # Build Javelin as a separate static library so we can control + # C++ standard without Zephyr's -std=c++11 interfering. + zephyr_library_named(javelin_steno) + zephyr_library_sources(${ALL_CXX_SRC}) + zephyr_library_compile_options( + -std=gnu++23 + -fno-exceptions + -fno-rtti + -fno-threadsafe-statics + ) + zephyr_library_compile_definitions( + JAVELIN_USE_EMBEDDED_STENO=1 + JAVELIN_USE_USER_DICTIONARY=1 + JAVELIN_PLATFORM_ZEPHYR=1 ) target_sources(app PRIVATE - ${ALL_CXX_SRC} ${ZMK_BEHAVIOR_SRC} )