From 2a2d27086f68188082e68d291907bce6ce758025 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Thu, 29 Jul 2021 16:16:15 +0200 Subject: [PATCH] esp_modem(0.1.9): Fix CMake3.5 build with no cxx_std_17 feature Older CMake (< 3.8, but still supported in IDF) doesn't support target_compile_features() for cxx_std_17. If CMake doesn't know C++17 features, set it manually via comile options. --- components/esp_modem/CMakeLists.txt | 11 ++++++++++- components/esp_modem/idf_component.yml | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/components/esp_modem/CMakeLists.txt b/components/esp_modem/CMakeLists.txt index f0c7e88e0..dea720007 100644 --- a/components/esp_modem/CMakeLists.txt +++ b/components/esp_modem/CMakeLists.txt @@ -33,7 +33,16 @@ idf_component_register(SRCS "${srcs}" PRIV_INCLUDE_DIRS private_include REQUIRES ${dependencies}) -target_compile_features(${COMPONENT_LIB} PRIVATE cxx_std_17) + +# If CMake doesn't know C++17 features, set it manually via comile options +# esp-modem component requires C++17 internally, but older CMake (< 3.8, but still supported in IDF) +# doesn't support target_compile_features() for cxx_std_17. +get_property(cxx_known_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) +if ("cxx_std_17" IN_LIST cxx_known_features) + target_compile_features(${COMPONENT_LIB} PRIVATE cxx_std_17) +else() + target_compile_options(${COMPONENT_LIB} PRIVATE "-std=gnu++17") +endif() if(${target} STREQUAL "linux") # This is needed for ESP_LOGx() macros, as integer formats differ on ESP32(..) and x64 diff --git a/components/esp_modem/idf_component.yml b/components/esp_modem/idf_component.yml index 338b6b957..31da00892 100644 --- a/components/esp_modem/idf_component.yml +++ b/components/esp_modem/idf_component.yml @@ -1,4 +1,4 @@ -version: "0.1.8" +version: "0.1.9" description: esp modem dependencies: # Required IDF version