From a5a1a4d7bdf24b79634d43a2d741f70754f63faa Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Wed, 13 Aug 2025 11:00:47 +0530 Subject: [PATCH] examples: remove redundant C++ standard setting in main component All examples already set the C++ standard in the project-level CMakeLists.txt. The main component redundantly sets it again. As per the ESP-IDF C++ support guide, a component should only override the C++ version if it intends to use a different one. We want to keep a consistent version across the project, so the redundant setting is removed. --- examples/all_device_types_app/main/CMakeLists.txt | 1 - examples/bridge_apps/blemesh_bridge/main/CMakeLists.txt | 1 - examples/bridge_apps/bridge_cli/main/CMakeLists.txt | 1 - examples/bridge_apps/esp-now_bridge_light/main/CMakeLists.txt | 1 - examples/bridge_apps/zigbee_bridge/main/CMakeLists.txt | 1 - examples/controller/main/CMakeLists.txt | 1 - examples/demo/badge/main/CMakeLists.txt | 1 - examples/door_lock/main/CMakeLists.txt | 3 +-- examples/generic_switch/main/CMakeLists.txt | 1 - examples/icd_app/main/CMakeLists.txt | 1 - examples/light/main/CMakeLists.txt | 1 - examples/light_network_prov/main/CMakeLists.txt | 1 - examples/light_switch/main/CMakeLists.txt | 1 - examples/managed_component_light/main/CMakeLists.txt | 3 +-- examples/mfg_test_app/main/CMakeLists.txt | 1 - examples/multiple_on_off_plugin_units/main/CMakeLists.txt | 1 - examples/ota_provider/main/CMakeLists.txt | 1 - examples/refrigerator/main/CMakeLists.txt | 1 - examples/room_air_conditioner/main/CMakeLists.txt | 1 - examples/sensors/main/CMakeLists.txt | 1 - examples/thread_border_router/main/CMakeLists.txt | 1 - examples/zap_light/main/CMakeLists.txt | 3 +-- 22 files changed, 3 insertions(+), 25 deletions(-) diff --git a/examples/all_device_types_app/main/CMakeLists.txt b/examples/all_device_types_app/main/CMakeLists.txt index 4dbb8dc4d..249a419a6 100644 --- a/examples/all_device_types_app/main/CMakeLists.txt +++ b/examples/all_device_types_app/main/CMakeLists.txt @@ -18,7 +18,6 @@ idf_component_register(SRC_DIRS ${SRC_DIRS_LIST} INCLUDE_DIRS ${INCLUDE_DIRS_LIST} LDFRAGMENTS "${ldfragments}") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") if(CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32S3) diff --git a/examples/bridge_apps/blemesh_bridge/main/CMakeLists.txt b/examples/bridge_apps/blemesh_bridge/main/CMakeLists.txt index 4564ca7c1..d23abda77 100644 --- a/examples/bridge_apps/blemesh_bridge/main/CMakeLists.txt +++ b/examples/bridge_apps/blemesh_bridge/main/CMakeLists.txt @@ -3,5 +3,4 @@ idf_component_register(SRC_DIRS "." "${ESP_MATTER_PATH}/examples/common/blemesh_platform" "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/bridge_apps/bridge_cli/main/CMakeLists.txt b/examples/bridge_apps/bridge_cli/main/CMakeLists.txt index 43626a795..eb1cee521 100644 --- a/examples/bridge_apps/bridge_cli/main/CMakeLists.txt +++ b/examples/bridge_apps/bridge_cli/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/bridge_apps/esp-now_bridge_light/main/CMakeLists.txt b/examples/bridge_apps/esp-now_bridge_light/main/CMakeLists.txt index 43626a795..eb1cee521 100644 --- a/examples/bridge_apps/esp-now_bridge_light/main/CMakeLists.txt +++ b/examples/bridge_apps/esp-now_bridge_light/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/bridge_apps/zigbee_bridge/main/CMakeLists.txt b/examples/bridge_apps/zigbee_bridge/main/CMakeLists.txt index 43626a795..eb1cee521 100644 --- a/examples/bridge_apps/zigbee_bridge/main/CMakeLists.txt +++ b/examples/bridge_apps/zigbee_bridge/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/controller/main/CMakeLists.txt b/examples/controller/main/CMakeLists.txt index f389817a2..568491b5d 100644 --- a/examples/controller/main/CMakeLists.txt +++ b/examples/controller/main/CMakeLists.txt @@ -7,5 +7,4 @@ if(CONFIG_SPIFFS_ATTESTATION_TRUST_STORE) spiffs_create_partition_image(paa_cert ${CMAKE_SOURCE_DIR}/paa_cert FLASH_IN_PROJECT) endif() -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/demo/badge/main/CMakeLists.txt b/examples/demo/badge/main/CMakeLists.txt index 43626a795..eb1cee521 100644 --- a/examples/demo/badge/main/CMakeLists.txt +++ b/examples/demo/badge/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/door_lock/main/CMakeLists.txt b/examples/door_lock/main/CMakeLists.txt index 2b3a07d3e..fd61b8839 100644 --- a/examples/door_lock/main/CMakeLists.txt +++ b/examples/door_lock/main/CMakeLists.txt @@ -2,5 +2,4 @@ idf_component_register(SRC_DIRS "." "./lock" PRIV_INCLUDE_DIRS "." "./lock" "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) -target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") \ No newline at end of file +target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/generic_switch/main/CMakeLists.txt b/examples/generic_switch/main/CMakeLists.txt index 43626a795..eb1cee521 100644 --- a/examples/generic_switch/main/CMakeLists.txt +++ b/examples/generic_switch/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/icd_app/main/CMakeLists.txt b/examples/icd_app/main/CMakeLists.txt index 28a6b519d..515a2fe7e 100644 --- a/examples/icd_app/main/CMakeLists.txt +++ b/examples/icd_app/main/CMakeLists.txt @@ -1,7 +1,6 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") if (CONFIG_IDF_TARGET_ESP32C5) diff --git a/examples/light/main/CMakeLists.txt b/examples/light/main/CMakeLists.txt index 79b9c142f..ab93eb876 100644 --- a/examples/light/main/CMakeLists.txt +++ b/examples/light/main/CMakeLists.txt @@ -5,5 +5,4 @@ if (CONFIG_ENABLE_SET_CERT_DECLARATION_API) target_add_binary_data(${COMPONENT_TARGET} "certification_declaration/certification_declaration.der" BINARY) endif() -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/light_network_prov/main/CMakeLists.txt b/examples/light_network_prov/main/CMakeLists.txt index 08892aea3..fd88b8ed3 100644 --- a/examples/light_network_prov/main/CMakeLists.txt +++ b/examples/light_network_prov/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." "./network_prov_scheme" PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils" "./network_prov_scheme") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/light_switch/main/CMakeLists.txt b/examples/light_switch/main/CMakeLists.txt index ebb991411..80545394c 100644 --- a/examples/light_switch/main/CMakeLists.txt +++ b/examples/light_switch/main/CMakeLists.txt @@ -7,5 +7,4 @@ endif() idf_component_register(SRC_DIRS ${SRC_DIRS_LIST} PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/managed_component_light/main/CMakeLists.txt b/examples/managed_component_light/main/CMakeLists.txt index b91d6b8e5..c24e3089c 100644 --- a/examples/managed_component_light/main/CMakeLists.txt +++ b/examples/managed_component_light/main/CMakeLists.txt @@ -2,5 +2,4 @@ idf_component_register(SRC_DIRS "." INCLUDE_DIRS "." PRIV_INCLUDE_DIRS "../../common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) -target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") \ No newline at end of file +target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/mfg_test_app/main/CMakeLists.txt b/examples/mfg_test_app/main/CMakeLists.txt index b87352694..9fe0bd01b 100644 --- a/examples/mfg_test_app/main/CMakeLists.txt +++ b/examples/mfg_test_app/main/CMakeLists.txt @@ -5,5 +5,4 @@ idf_component_register(SRC_DIRS "." PRIV_REQUIRES ${PRIV_REQUIRES_LIST} EMBED_FILES "paa_cert.der") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/multiple_on_off_plugin_units/main/CMakeLists.txt b/examples/multiple_on_off_plugin_units/main/CMakeLists.txt index 43626a795..eb1cee521 100644 --- a/examples/multiple_on_off_plugin_units/main/CMakeLists.txt +++ b/examples/multiple_on_off_plugin_units/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/ota_provider/main/CMakeLists.txt b/examples/ota_provider/main/CMakeLists.txt index 4692938c0..51f07903e 100644 --- a/examples/ota_provider/main/CMakeLists.txt +++ b/examples/ota_provider/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS ".") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/refrigerator/main/CMakeLists.txt b/examples/refrigerator/main/CMakeLists.txt index a27fc417c..faace46dd 100644 --- a/examples/refrigerator/main/CMakeLists.txt +++ b/examples/refrigerator/main/CMakeLists.txt @@ -10,5 +10,4 @@ idf_component_register(SRCS ${SRC_LIST} INCLUDE_DIRS ${INCLUDE_DIRS_LIST} PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/room_air_conditioner/main/CMakeLists.txt b/examples/room_air_conditioner/main/CMakeLists.txt index 43626a795..eb1cee521 100644 --- a/examples/room_air_conditioner/main/CMakeLists.txt +++ b/examples/room_air_conditioner/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/sensors/main/CMakeLists.txt b/examples/sensors/main/CMakeLists.txt index 6d7421c78..e7486af3c 100644 --- a/examples/sensors/main/CMakeLists.txt +++ b/examples/sensors/main/CMakeLists.txt @@ -1,5 +1,4 @@ idf_component_register(SRC_DIRS "." "drivers" PRIV_INCLUDE_DIRS "." "drivers" "${ESP_MATTER_PATH}/examples/common/utils") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/thread_border_router/main/CMakeLists.txt b/examples/thread_border_router/main/CMakeLists.txt index e33ddae48..a95cdf70f 100644 --- a/examples/thread_border_router/main/CMakeLists.txt +++ b/examples/thread_border_router/main/CMakeLists.txt @@ -2,5 +2,4 @@ idf_component_register(SRC_DIRS "." INCLUDE_DIRS "." LDFRAGMENTS "linker.lf") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/zap_light/main/CMakeLists.txt b/examples/zap_light/main/CMakeLists.txt index 7b336ce3f..53b7786c1 100644 --- a/examples/zap_light/main/CMakeLists.txt +++ b/examples/zap_light/main/CMakeLists.txt @@ -8,12 +8,11 @@ idf_component_register(SRC_DIRS "." # We must set CHIP_ROOT to include chip_data_model.cmake get_filename_component(CHIP_ROOT "${MATTER_SDK_PATH}" REALPATH) include(${CHIP_ROOT}/src/app/chip_data_model.cmake) -chip_configure_data_model(${COMPONENT_LIB} +chip_configure_data_model(${COMPONENT_LIB} ZAP_FILE ${CHIP_ROOT}/examples/lighting-app/lighting-common/lighting-app.zap) add_prebuilt_library(matterlib "${CMAKE_BINARY_DIR}/esp-idf/chip/lib/libCHIP.a" REQUIRES esp_matter main) target_link_libraries(${COMPONENT_LIB} INTERFACE matterlib) -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H")