aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRaef Coles <raef.coles@arm.com>2020-09-28 14:11:53 +0100
committerTamas Ban <tamas.ban@arm.com>2020-10-07 15:00:52 +0000
commite43c02041342a849b41f1b27350eb75e3027dbba (patch)
treecec5df541938742edb4a751357c4ce5e4f3e713a /tools
parent6e8f83d0381a7561c38deb7bb4ef868d86ac10ea (diff)
downloadtrusted-firmware-m-e43c02041342a849b41f1b27350eb75e3027dbba.tar.gz
Build: Make file generation more robust
Alter file generation so that it is correctly run when files are updated. Also make sure to run the generation if other manifest lists are added after cmake is run. Change-Id: Iad742b0c5daa79a1f2b5b23e7850d3e7beef9c85 Signed-off-by: Raef Coles <raef.coles@arm.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/CMakeLists.txt26
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index e1be320a2..0d027e8f6 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -67,9 +67,8 @@ if ("${TEST_PSA_API}" STREQUAL "IPC")
)
endif()
-add_custom_target(OUTPUT ${OUTPUT_FILES}
- DEPENDS ${TEMPLATE_FILES} ${MANIFEST_FILES}
- DEPENDS ${MANIFEST_LISTS}
+add_custom_target(tfm_generated_files
+ SOURCES ${OUTPUT_FILES}
)
add_custom_command(OUTPUT ${OUTPUT_FILES}
@@ -83,14 +82,15 @@ add_custom_command(OUTPUT ${OUTPUT_FILES}
# The files need to be generated before cmake will allow them to be used as
# sources. Due to issue with custom_command scoping the easiest way to do this
-# is to run the script at cmake-time if any of the files don't exist.
-foreach(output_file ${OUTPUT_FILES})
- if(NOT EXISTS ${output_file})
- execute_process(
- COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tfm_parse_manifest_list.py
- -m ${MANIFEST_LISTS}
- -f ${GENERATED_FILE_LISTS}
- -o ${CMAKE_BINARY_DIR}/generated
- )
+# is to run the script at cmake-time.
+execute_process(
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tfm_parse_manifest_list.py
+ -m ${MANIFEST_LISTS}
+ -f ${GENERATED_FILE_LISTS}
+ -o ${CMAKE_BINARY_DIR}/generated
+ RESULT_VARIABLE RET
+)
+
+if(NOT RET EQUAL 0)
+ message(FATAL_ERROR "File generation failed")
endif()
-endforeach()