Make add_components CMake function reentrant
Change the scope of the internally used TGT variable from global
(cached) to local, allowing add_components calls on multiple levels.
Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: I48f4000d6157e7b3c572b5c1b0645ee1d0b7a24a
diff --git a/tools/cmake/common/AddComponents.cmake b/tools/cmake/common/AddComponents.cmake
index 07978bb..b48f1bf 100644
--- a/tools/cmake/common/AddComponents.cmake
+++ b/tools/cmake/common/AddComponents.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -50,11 +50,10 @@
set(MY_PARAMS_BASE_DIR "${MY_PARAMS_BASE_DIR}/")
endif()
- set(TGT ${MY_PARAMS_TARGET} CACHE STRING "")
+ set(TGT ${MY_PARAMS_TARGET})
foreach(_comp IN ITEMS ${MY_PARAMS_COMPONENTS})
set(_file ${MY_PARAMS_BASE_DIR}${_comp}/component.cmake)
include(${_file})
set(CMAKE_CONFIGURE_DEPENDS ${_file})
endforeach()
- unset(TGT CACHE)
endfunction()