Skip to content

Commit dc5ca47

Browse files
tejlmandnordicjm
authored andcommitted
sysbuild: create intermediate file for CMakeCache.txt configuration
Using `configure_file()` directly on an image's CMakeCache.txt file creates a sysbuild CMake configure dependency on the image's cache file. This means that any change to the CMake cache on any image results in a CMake re-run on all images. Create an intermediate file for configure_file() to depend upon. The aligns sysbuild in nRF Connect SDK behavior with Zephyr wrt. image CMake cache dependencies. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
1 parent 7020a65 commit dc5ca47

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sysbuild/CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ function(configure_cache)
2525

2626
ExternalProject_Get_Property(${CONFIGURE_CACHE_IMAGE} BINARY_DIR)
2727

28-
configure_file("${BINARY_DIR}/CMakeCache.txt" "${BINARY_DIR}/CMakeCache.txt.tmp" @ONLY)
28+
# Copy the cache file to avoid a dependency to the image's cache file.
29+
# A dependency on the image's cache file cause unneccessary CMake re-runs for
30+
# all sysbuild images whenever a setting in the cache changes, even for not
31+
# sysbuild relevant changes.
32+
zephyr_file_copy("${BINARY_DIR}/CMakeCache.txt" "${BINARY_DIR}/CMakeCache.tmp" ONLY_IF_DIFFERENT)
33+
configure_file("${BINARY_DIR}/CMakeCache.tmp" "${BINARY_DIR}/CMakeCache.txt.tmp" @ONLY)
2934
zephyr_file_copy("${BINARY_DIR}/CMakeCache.txt.tmp" "${BINARY_DIR}/CMakeCache.txt" ONLY_IF_DIFFERENT)
3035
endfunction()
3136

0 commit comments

Comments
 (0)