Build: Support out-of-tree platforms
Allows -DTFM_PLATFORM to be set to paths outside the TFM tree.
e.g.
cmake ... -DTFM_PLATFORM=../../../../tfm_platforms/my_platform
Note: TFM_PLATFORM currently only accepts paths relative from
platform/ext/target
Change-Id: I99d194fdee43ffa29da67b22eb79ef5e450c1559
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 1fcecc7..3deee99 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -8,9 +8,10 @@
# Generate correct filename
string(TOUPPER ${TFM_PLATFORM} TFM_PLATFORM_UPPERCASE)
string(REGEX REPLACE "-" "_" TFM_PLATFORM_UPPERCASE_UNDERSCORE ${TFM_PLATFORM_UPPERCASE})
+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}
+ DESTINATION ${CMAKE_BINARY_DIR}/install/outputs/${TFM_PLATFORM_UPPERCASE_UNDERSCORE_NO_PARENT_DIR}
)
set(INTERFACE_INC_DIR ${CMAKE_SOURCE_DIR}/interface/include)