Skip to content

Commit 2a2e1ce

Browse files
committed
[nrf noup] cmake: tools: Dont add a custom command for running the manifest
This commit is [nrf noup] because I would like to user-test this for a few months in case of unintended side-effects before upstreaming. In the TF-M build scripts we run the manifest tool twice, first from CMake and then from ninja. It is bad practice to configure CMake projects like this. Instead, if configuration from CMake is necessary, one should configure from CMake only, and then re-run CMake when necessary, not just the command. This organization has been causing problems for our users as they have been required to rebuild TF-M twice. This is due to this scenario playing out: CMake generates config_impl.cmake by invoking the manifest tool at Configure time. CMake generates build.ninja. Ninja generates config_impl.cmake by invoking the manifest tool at build time. When the user then invokes ninja a second time config_impl.cmake will be newer than build.ninja. But CMake is supposed to be includ'ing config_impl.cmake, so build.ninja is now considered out-of-date wrt. config_impl.cmake. ninja therefore invokes CMake again, and then ninja afterwards. Signed-off-by: Sebastian Bøe <[email protected]> Change-Id: Icef588479d27fa3a172b40b09eacad417922fba5
1 parent 4eff835 commit 2a2e1ce

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,17 @@ set(MANIFEST_COMMAND
159159
-o ${CMAKE_BINARY_DIR}/generated
160160
${PARSE_MANIFEST_QUIET_FLAG})
161161

162+
set(NO_BUILD_CMD_FOR_MANIFEST 1)
163+
164+
if(NO_BUILD_CMD_FOR_MANIFEST)
165+
else()
162166
add_custom_command(
163167
OUTPUT ${CMAKE_BINARY_DIR}/generated
164168
COMMAND ${MANIFEST_COMMAND}
165169
DEPENDS ${MANIFEST_LISTS} ${GENERATED_FILE_LISTS}
166170
${MANIFEST_FILES} ${TEMPLATE_FILES}
167171
)
172+
endif()
168173

169174
add_custom_target(
170175
manifest_tool

0 commit comments

Comments
 (0)