From 70dfcb35d44430256cb56c9c7ec21cfdcc8639c8 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Tue, 4 Jun 2019 20:19:25 +0800 Subject: [PATCH] mbedtls: component CMakeLists.txt corrections Since !4452 the common component requirements automatically get privately linked to libraries built under ESP-IDF build system (this includes targets from third-party libraries). This removes a variable that was used for that purpose before !4452. Since the internal target names were changed, the compile definition for warning on using deprecated functions is not being passed. Since using the internal name is unreliable, prefer passing this compile definition from the test itself. --- components/mbedtls/CMakeLists.txt | 9 +-------- components/mbedtls/test/CMakeLists.txt | 6 ++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index 3b1fd504e2..44af366f45 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -2,8 +2,6 @@ set(COMPONENT_ADD_INCLUDEDIRS "port/include" "mbedtls/include") set(COMPONENT_SRCS "mbedtls.c") set(COMPONENT_REQUIRES lwip) -set(MBEDTLS_PRIV_REQUIRES ${IDF_COMPONENT_REQUIRES_COMMON} soc) - register_component() # Only build mbedtls libraries @@ -96,9 +94,4 @@ foreach(target ${mbedtls_targets}) endforeach() # Link mbedtls libraries to component library -target_link_libraries(${COMPONENT_LIB} ${mbedtls_targets}) - -# Catch usage of deprecated mbedTLS functions when building tests -if(mbedtls_test IN_LIST BUILD_TEST_COMPONENTS) - add_definitions(-DMBEDTLS_DEPRECATED_WARNING) -endif() \ No newline at end of file +target_link_libraries(${COMPONENT_LIB} ${mbedtls_targets}) \ No newline at end of file diff --git a/components/mbedtls/test/CMakeLists.txt b/components/mbedtls/test/CMakeLists.txt index e1aad74fac..5a8cfd8d33 100644 --- a/components/mbedtls/test/CMakeLists.txt +++ b/components/mbedtls/test/CMakeLists.txt @@ -4,3 +4,9 @@ set(COMPONENT_ADD_INCLUDEDIRS ".") set(COMPONENT_REQUIRES unity test_utils mbedtls) register_component() + +idf_component_get_property(mbedtls mbedtls COMPONENT_LIB) +target_compile_definitions(${mbedtls} PUBLIC "-DMBEDTLS_DEPRECATED_WARNING") +target_compile_definitions(mbedtls PUBLIC "-DMBEDTLS_DEPRECATED_WARNING") +target_compile_definitions(mbedcrypto PUBLIC "-DMBEDTLS_DEPRECATED_WARNING") +target_compile_definitions(mbedx509 PUBLIC "-DMBEDTLS_DEPRECATED_WARNING")