Build: Support Armclang in build split
Enable policy CMP0123 to support Armclang.
Support Armclang specific link option.
Signed-off-by: David Hu <david.hu@arm.com>
Change-Id: Ice70afc0a07b3114d2552aa1c2ce44c4bb1c41fe
diff --git a/tests_reg/CMakeLists.txt b/tests_reg/CMakeLists.txt
index e3f7685..f09f951 100644
--- a/tests_reg/CMakeLists.txt
+++ b/tests_reg/CMakeLists.txt
@@ -6,6 +6,15 @@
#-------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.15)
+# CMake 3.21 and above requests projects to specify cpu/arch compile and link flags explicitly in
+# Armclang. Link: https://cmake.org/cmake/help/latest/policy/CMP0123.html
+# It is aligned with current Armclang toolchain implementation.
+# Explictly set this policy to NEW behavior to eliminate long warnings. It shall be set in root
+# CMakeLists.txt otherwise project() will throw out the warnings.
+if(POLICY CMP0123)
+ cmake_policy(SET CMP0123 NEW)
+endif()
+
if (NOT DEFINED CONFIG_SPE_PATH OR NOT EXISTS ${CONFIG_SPE_PATH})
message(FATAL_ERROR "CONFIG_SPE_PATH = ${CONFIG_SPE_PATH} is not defined or incorrect. Please provide full path to TF-M build artifacts using -DCONFIG_SPE_PATH=")
endif()
@@ -67,6 +76,7 @@
target_link_options(tfm_ns
PRIVATE
$<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map>
+ $<$<C_COMPILER_ID:ARMClang>:--map>
)
add_convert_to_bin_target(tfm_ns)