mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-17 12:32:14 +02:00
build: fix issue with passing cxx_std option, a common workaround
issue: https://gitlab.kitware.com/cmake/cmake/-/issues/23297
This commit is contained in:
@ -34,16 +34,11 @@ idf_component_register(SRCS "${srcs}"
|
|||||||
PRIV_INCLUDE_DIRS private_include
|
PRIV_INCLUDE_DIRS private_include
|
||||||
REQUIRES ${dependencies})
|
REQUIRES ${dependencies})
|
||||||
|
|
||||||
|
set_target_properties(${COMPONENT_LIB} PROPERTIES
|
||||||
# If CMake doesn't know C++17 features, set it manually via comile options
|
CXX_STANDARD 17
|
||||||
# esp-modem component requires C++17 internally, but older CMake (< 3.8, but still supported in IDF)
|
CXX_STANDARD_REQUIRED ON
|
||||||
# doesn't support target_compile_features() for cxx_std_17.
|
CXX_EXTENSIONS ON
|
||||||
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")
|
if(${target} STREQUAL "linux")
|
||||||
# This is needed for ESP_LOGx() macros, as integer formats differ on ESP32(..) and x64
|
# This is needed for ESP_LOGx() macros, as integer formats differ on ESP32(..) and x64
|
||||||
|
@ -5,5 +5,9 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(${COMPONENT_LIB} PRIVATE Threads::Threads)
|
target_link_libraries(${COMPONENT_LIB} PRIVATE Threads::Threads)
|
||||||
|
|
||||||
target_compile_features(${COMPONENT_LIB} PRIVATE cxx_std_17)
|
set_target_properties(${COMPONENT_LIB} PROPERTIES
|
||||||
|
CXX_STANDARD 17
|
||||||
|
CXX_STANDARD_REQUIRED ON
|
||||||
|
CXX_EXTENSIONS ON
|
||||||
|
)
|
||||||
target_compile_definitions(${COMPONENT_LIB} PRIVATE "-DCONFIG_IDF_TARGET_LINUX")
|
target_compile_definitions(${COMPONENT_LIB} PRIVATE "-DCONFIG_IDF_TARGET_LINUX")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: "0.1.13"
|
version: "0.1.14"
|
||||||
description: esp modem
|
description: esp modem
|
||||||
dependencies:
|
dependencies:
|
||||||
# Required IDF version
|
# Required IDF version
|
||||||
|
@ -6,5 +6,9 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(${COMPONENT_LIB} PRIVATE Threads::Threads)
|
target_link_libraries(${COMPONENT_LIB} PRIVATE Threads::Threads)
|
||||||
|
|
||||||
target_compile_features(${COMPONENT_LIB} PRIVATE cxx_std_17)
|
set_target_properties(${COMPONENT_LIB} PROPERTIES
|
||||||
|
CXX_STANDARD 17
|
||||||
|
CXX_STANDARD_REQUIRED ON
|
||||||
|
CXX_EXTENSIONS ON
|
||||||
|
)
|
||||||
target_compile_definitions(${COMPONENT_LIB} PRIVATE "-DCONFIG_IDF_TARGET_LINUX")
|
target_compile_definitions(${COMPONENT_LIB} PRIVATE "-DCONFIG_IDF_TARGET_LINUX")
|
||||||
|
@ -3,4 +3,8 @@ idf_component_register(SRCS "pppd_test.cpp"
|
|||||||
INCLUDE_DIRS "$ENV{IDF_PATH}/tools/catch"
|
INCLUDE_DIRS "$ENV{IDF_PATH}/tools/catch"
|
||||||
REQUIRES esp_modem)
|
REQUIRES esp_modem)
|
||||||
|
|
||||||
target_compile_features(${COMPONENT_LIB} PRIVATE cxx_std_17)
|
set_target_properties(${COMPONENT_LIB} PROPERTIES
|
||||||
|
CXX_STANDARD 17
|
||||||
|
CXX_STANDARD_REQUIRED ON
|
||||||
|
CXX_EXTENSIONS ON
|
||||||
|
)
|
||||||
|
Reference in New Issue
Block a user