Build: Allow alteration of cmake install path

Change-Id: I4e519d59448b74679a7d1bfa2171ffa024263944
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 806ebde..e7722c3 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -12,18 +12,19 @@
 string(REGEX REPLACE "^(\\.\\.([\\/\\\\]))+" "EXTERNAL\\2" TFM_PLATFORM_UPPERCASE_UNDERSCORE_NO_PARENT_DIR ${TFM_PLATFORM_UPPERCASE_UNDERSCORE})
 
 install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/
-        DESTINATION ${CMAKE_BINARY_DIR}/install/outputs/${TFM_PLATFORM_UPPERCASE_UNDERSCORE_NO_PARENT_DIR}
+        DESTINATION ${TFM_INSTALL_PATH}/outputs/${TFM_PLATFORM_UPPERCASE_UNDERSCORE_NO_PARENT_DIR}
 )
 
 set(INTERFACE_INC_DIR ${CMAKE_SOURCE_DIR}/interface/include)
 set(INTERFACE_SRC_DIR ${CMAKE_SOURCE_DIR}/interface/src)
-set(EXPORT_INC_DIR    ${CMAKE_BINARY_DIR}/install/export/tfm/include)
-set(EXPORT_SRC_DIR    ${CMAKE_BINARY_DIR}/install/export/tfm/src)
+set(EXPORT_INC_DIR    ${TFM_INSTALL_PATH}/export/tfm/include)
+set(EXPORT_SRC_DIR    ${TFM_INSTALL_PATH}/export/tfm/src)
+set(EXPORT_LIB_DIR    ${TFM_INSTALL_PATH}/export/tfm/lib)
 
 # export veneer lib
 if (NOT TFM_MULTI_CORE_TOPOLOGY)
     install(FILES       ${CMAKE_BINARY_DIR}/secure_fw/s_veneers.o
-            DESTINATION ${CMAKE_BINARY_DIR}/install/export/tfm/lib)
+            DESTINATION ${EXPORT_LIB_DIR})
 endif()
 
 ####################### export headers #########################################
diff --git a/config/config_default.cmake b/config/config_default.cmake
index f86bf85..db8e70d 100644
--- a/config/config_default.cmake
+++ b/config/config_default.cmake
@@ -31,6 +31,8 @@
 set(TFM_CODE_SHARING                    OFF         CACHE PATH      "Enable code sharing between MCUboot and secure firmware")
 set(TFM_CODE_SHARING_PATH               ""          CACHE PATH      "Path to repo which shares code with secure firmware")
 
+set(TFM_INSTALL_PATH                    ${CMAKE_BINARY_DIR}/install CACHE PATH "Path to which to install TF-M files")
+
 ########################## BL2 #################################################
 
 set(MCUBOOT_IMAGE_NUMBER                2           CACHE STRING    "Whether to combine S and NS into either 1 image, or sign each seperately")
diff --git a/docs/getting_started/tfm_integration_guide.rst b/docs/getting_started/tfm_integration_guide.rst
index 9c1cf30..e883750 100644
--- a/docs/getting_started/tfm_integration_guide.rst
+++ b/docs/getting_started/tfm_integration_guide.rst
@@ -117,9 +117,9 @@
 Interface with TF-M
 ===================
 The files needed for the interface with TF-M are exported at the
-``<build_dir>/install/export/tfm`` path. The NS side is only allowed to call
+``<install_dir>/export/tfm`` path. The NS side is only allowed to call
 TF-M secure functions (veneers) from the NS Thread mode. For this reason, the
-API is a collection of functions in the ``<build_dir>/install/export/tfm/inc``
+API is a collection of functions in the ``<install_dir>/export/tfm/inc``
 directory. For example, the interface for the Protected Storage (PS) service
 is described in the file ``psa_ps_api.h`` as a collection of functions that
 call service veneer functions. This API is a wrapper for the secure veneers,
@@ -182,4 +182,4 @@
 
 --------------
 
-*Copyright (c) 2017-2020, Arm Limited. All rights reserved.*
+*Copyright (c) 2017-2021, Arm Limited. All rights reserved.*