Build: Define TEST_DIR once and use it everywhere
The TEST_DIR was defined in multiple files and it was not used
everywhere, some uses ${TFM_ROOT_DIR}/test instead.
This patch unifies the TEST_DIR definition to CommonConfig.cmake
and use it everywhere.
Change-Id: I04d1104ad2453f4fa595b27b7a77146acf809e4f
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/CommonConfig.cmake b/CommonConfig.cmake
index b2febdc..679a0d3 100644
--- a/CommonConfig.cmake
+++ b/CommonConfig.cmake
@@ -21,6 +21,8 @@
message(FATAL_ERROR "ERROR: Compiler \"${COMPILER}\" is not supported.")
endif()
+set(TEST_DIR ${CMAKE_SOURCE_DIR}/test)
+
#Configure the default build type
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (i.e. Debug)")
@@ -312,7 +314,7 @@
set(TFM_PARTITION_AUDIT_LOG OFF)
endif()
-include(${CMAKE_CURRENT_LIST_DIR}/test/TestConfig.cmake)
+include(${TEST_DIR}/TestConfig.cmake)
if (TFM_PARTITION_AUDIT_LOG)
add_definitions(-DTFM_PARTITION_AUDIT_LOG)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 164cf33..2039a6a 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -15,7 +15,6 @@
set(APP_DIR ${CMAKE_CURRENT_LIST_DIR})
get_filename_component(TFM_ROOT_DIR ${APP_DIR}/.. ABSOLUTE)
set(INTERFACE_DIR ${TFM_ROOT_DIR}/interface)
-set(TEST_DIR ${TFM_ROOT_DIR}/test)
#Include common stuff to control cmake.
include("Common/BuildSys")
@@ -216,7 +215,7 @@
target_compile_definitions(${PROJECT_OBJ_LIB} PRIVATE TFM_NS_CLIENT_IDENTIFICATION)
endif()
-add_subdirectory(${TFM_ROOT_DIR}/test ${CMAKE_BINARY_DIR}/test/non_secure_test)
+add_subdirectory(${TEST_DIR} ${CMAKE_BINARY_DIR}/test/non_secure_test)
# For the non-swapping BL2 configuration two executables need to be built.
# One can be executed from the primary slot flash partition and other from the
@@ -420,7 +419,7 @@
#Add the test source to the build.
#As of today since secure_fw is built as a sub-project this code will never execute.
option(ENABLE_PROTECTED_STORAGE_SERVICE_TESTS "" TRUE)
- include(../test/CMakeLists.inc)
+ include(${TEST_DIR}/CMakeLists.inc)
target_sources(${PROJECT_OBJ_LIB} PUBLIC ${ALL_SRC_C} ${ALL_SRC_C_NS})
endif()
diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
index 216c92a..336b4c8 100644
--- a/secure_fw/CMakeLists.txt
+++ b/secure_fw/CMakeLists.txt
@@ -14,7 +14,6 @@
set(SECURE_FW_DIR "${CMAKE_CURRENT_LIST_DIR}")
set(TFM_ROOT_DIR "${SECURE_FW_DIR}/..")
-set(TEST_DIR "${TFM_ROOT_DIR}/test")
set(INTERFACE_DIR "${TFM_ROOT_DIR}/interface")
#Include common stuff to control cmake.
@@ -513,7 +512,7 @@
endfunction()
#Adds the test directory
-add_subdirectory(${TFM_ROOT_DIR}/test ${CMAKE_BINARY_DIR}/test/secure_test)
+add_subdirectory(${TEST_DIR} ${CMAKE_BINARY_DIR}/test/secure_test)
#Add the crypto library target
if (TFM_PARTITION_CRYPTO)