Build: Decouple tf-m-tests config setting from TF-M repo
Move tf-m-tests specific config setting to tf-m-tests repo to decouple
tf-m-tests config from TF-M.
In the meantime, move tf-m-tests repo fetch operation during TF-M config
setting. Therefore, tf-m-tests specific config file is available when
TF-M config starts as tf-m-tests configs are coupled with those in TF-M.
Change-Id: I5dd7e382378990c6dfe7a5a148d0e12d7933d1a1
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/lib/ext/CMakeLists.txt b/lib/ext/CMakeLists.txt
index ced2557..cbe86e7 100644
--- a/lib/ext/CMakeLists.txt
+++ b/lib/ext/CMakeLists.txt
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -9,7 +9,6 @@
add_subdirectory(qcbor)
add_subdirectory(t_cose)
add_subdirectory(mbedcrypto)
-add_subdirectory(tf-m-tests)
add_subdirectory(CMSIS_5)
if(BL2)
add_subdirectory(mcuboot)
diff --git a/lib/ext/tf-m-tests/CMakeLists.txt b/lib/ext/tf-m-tests/fetch_repo.cmake
similarity index 90%
rename from lib/ext/tf-m-tests/CMakeLists.txt
rename to lib/ext/tf-m-tests/fetch_repo.cmake
index e0b0bde..47bce13 100644
--- a/lib/ext/tf-m-tests/CMakeLists.txt
+++ b/lib/ext/tf-m-tests/fetch_repo.cmake
@@ -1,18 +1,20 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-include(FetchContent)
-set(FETCHCONTENT_QUIET FALSE)
-
# Set to not download submodules if that option is available
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
cmake_policy(SET CMP0097 NEW)
endif()
+include(FetchContent)
+set(FETCHCONTENT_QUIET FALSE)
+
+set(FETCHCONTENT_BASE_DIR ${CMAKE_BINARY_DIR}/lib/ext CACHE STRING "" FORCE)
+
if ("${TFM_TEST_REPO_PATH}" STREQUAL "DOWNLOAD")
FetchContent_Declare(tfm_test_repo
GIT_REPOSITORY https://git.trustedfirmware.org/TF-M/tf-m-tests.git
diff --git a/lib/ext/tf-m-tests/repo_config_default.cmake b/lib/ext/tf-m-tests/repo_config_default.cmake
new file mode 100644
index 0000000..7b6b916
--- /dev/null
+++ b/lib/ext/tf-m-tests/repo_config_default.cmake
@@ -0,0 +1,12 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2021, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+# Default configs of tf-m-tests repo
+
+set(TFM_TEST_REPO_PATH "DOWNLOAD" CACHE PATH "Path to TFM-TEST repo (or DOWNLOAD to fetch automatically")
+set(TFM_TEST_REPO_VERSION "0326315" CACHE STRING "The version of tf-m-tests to use")
+set(CMSIS_5_PATH "DOWNLOAD" CACHE PATH "Path to CMSIS_5 (or DOWNLOAD to fetch automatically")