Skip to content

Commit 45cb09e

Browse files
committed
[nrf fromlist] cmake: Use temp. for edt pickle CMake output
This potentially fixes an issues whereby when sysbuild projects import dts configuration from images and images are reconfigured, that sysbuild will needlessly rerun even if the output has not changed by using a temporary output file and then only updating the actual file if the contents have changed Upstream PR #: 96259 Signed-off-by: Jamie McCrae <[email protected]>
1 parent d32b794 commit 45cb09e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmake/modules/extensions.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4698,6 +4698,7 @@ function(zephyr_dt_import)
46984698
zephyr_check_arguments_required_all(${CMAKE_CURRENT_FUNCTION} arg ${req_single_args})
46994699

47004700
set(gen_dts_cmake_script ${ZEPHYR_BASE}/scripts/dts/gen_dts_cmake.py)
4701+
set(gen_dts_cmake_temp ${arg_EDT_PICKLE_FILE}.cmake.new)
47014702
set(gen_dts_cmake_output ${arg_EDT_PICKLE_FILE}.cmake)
47024703

47034704
if((${arg_EDT_PICKLE_FILE} IS_NEWER_THAN ${gen_dts_cmake_output}) OR
@@ -4706,11 +4707,13 @@ function(zephyr_dt_import)
47064707
execute_process(
47074708
COMMAND ${PYTHON_EXECUTABLE} ${gen_dts_cmake_script}
47084709
--edt-pickle ${arg_EDT_PICKLE_FILE}
4709-
--cmake-out ${gen_dts_cmake_output}
4710+
--cmake-out ${gen_dts_cmake_temp}
47104711
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
47114712
RESULT_VARIABLE ret
47124713
COMMAND_ERROR_IS_FATAL ANY
47134714
)
4715+
4716+
file(COPY_FILE ${gen_dts_cmake_temp} ${gen_dts_cmake_output} ONLY_IF_DIFFERENT)
47144717
endif()
47154718
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${gen_dts_cmake_script})
47164719

0 commit comments

Comments
 (0)