cmake: Ported mbedTLS to use Zephyr interface libraries

mbedTLS include directories will now default to be in the 'app'
include path when mbedTLS has been enabled.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2017-12-27 16:10:15 +01:00 committed by Anas Nashif
parent 3c8331d390
commit 6f642a19fd
13 changed files with 10 additions and 23 deletions

View file

@ -1,4 +1,4 @@
add_library(mbedTLS INTERFACE)
zephyr_interface_library_named(mbedTLS)
target_compile_definitions(mbedTLS INTERFACE
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}"
)

View file

@ -98,3 +98,12 @@ config MBEDTLS_HEAP_SIZE
application. For server application 15000 bytes should be enough.
For some dedicated and specific usage of mbedtls API, the 1000 bytes
might be ok.
config APP_LINK_WITH_MBEDTLS
bool "Link 'app' with MBEDTLS"
default y
depends on MBEDTLS
help
Add MBEDTLS header files to the 'app' include path. It may be
disabled if the include paths for MBEDTLS are causing aliasing
issues for 'app'.

View file

@ -1,7 +1,5 @@
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)
target_link_libraries(app mbedTLS)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -1,7 +1,5 @@
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)
target_link_libraries(app mbedTLS)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -6,5 +6,3 @@ target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c)
target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c)
include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake)
target_link_libraries_ifdef(CONFIG_MBEDTLS app mbedTLS)

View file

@ -6,5 +6,3 @@ target_sources_ifdef(CONFIG_NET_UDP app PRIVATE src/udp.c)
target_sources_ifdef(CONFIG_NET_TCP app PRIVATE src/tcp.c)
include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake)
target_link_libraries_ifdef(CONFIG_MBEDTLS app mbedTLS)

View file

@ -19,5 +19,3 @@ foreach(inc_file
${ZEPHYR_BINARY_DIR}/include/generated/${inc_file}.inc
)
endforeach()
target_link_libraries_ifdef(CONFIG_MBEDTLS app mbedTLS)

View file

@ -5,5 +5,3 @@ FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
include($ENV{ZEPHYR_BASE}/samples/net/common/common.cmake)
target_link_libraries_ifdef(CONFIG_MBEDTLS app mbedTLS)

View file

@ -1,7 +1,5 @@
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)
target_link_libraries(app mbedTLS)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -1,7 +1,5 @@
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)
target_link_libraries(app mbedTLS)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -1,7 +1,5 @@
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)
target_link_libraries(app mbedTLS)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -1,6 +1,5 @@
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)
target_link_libraries(app mbedTLS)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -5,8 +5,5 @@ target_include_directories(app PRIVATE
$ENV{ZEPHYR_BASE}/subsys/net/ip
$ENV{ZEPHYR_BASE}/subsys/net/lib/mqtt
)
if(CONFIG_MBEDTLS)
target_link_libraries(app mbedTLS)
endif()
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})