cmake: Remove global include directories
Remove the declaration of ./include and ./library
as include directories for all targets.
Prefer being more local and declare include directories
at the target level using target_include_directories().
Note that there is no need to declare explicitely
./include as an include directory for tests as they
inherit it from the "mbed librairies".
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index de50c72..61f149f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -205,9 +205,6 @@
set(LIB_INSTALL_DIR lib)
endif()
-include_directories(include/)
-include_directories(library/)
-
if(ENABLE_ZLIB_SUPPORT)
find_package(ZLIB)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 39a7a2c..182109b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -48,7 +48,10 @@
add_executable(test_suite_${data_name} test_suite_${data_name}.c $<TARGET_OBJECTS:mbedtests>)
target_link_libraries(test_suite_${data_name} ${libs})
- target_include_directories(test_suite_${data_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
+ target_include_directories(test_suite_${data_name}
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../library)
+
if(${data_name} MATCHES ${SKIP_TEST_SUITES_REGEX})
message(STATUS "The test suite ${data_name} will not be executed.")
else()
@@ -68,7 +71,10 @@
file(GLOB MBEDTESTS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c)
add_library(mbedtests OBJECT ${MBEDTESTS_FILES})
-target_include_directories(mbedtests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
+target_include_directories(mbedtests
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../library)
add_test_suite(aes aes.cbc)
add_test_suite(aes aes.cfb)