Skip to content

Commit dc56fb2

Browse files
nordicjmfabiobaltieri
authored andcommitted
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 Signed-off-by: Jamie McCrae <[email protected]>
1 parent 2d2c087 commit dc56fb2

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
@@ -4705,6 +4705,7 @@ function(zephyr_dt_import)
47054705
zephyr_check_arguments_required_all(${CMAKE_CURRENT_FUNCTION} arg ${req_single_args})
47064706

47074707
set(gen_dts_cmake_script ${ZEPHYR_BASE}/scripts/dts/gen_dts_cmake.py)
4708+
set(gen_dts_cmake_temp ${arg_EDT_PICKLE_FILE}.cmake.new)
47084709
set(gen_dts_cmake_output ${arg_EDT_PICKLE_FILE}.cmake)
47094710

47104711
if((${arg_EDT_PICKLE_FILE} IS_NEWER_THAN ${gen_dts_cmake_output}) OR
@@ -4713,11 +4714,13 @@ function(zephyr_dt_import)
47134714
execute_process(
47144715
COMMAND ${PYTHON_EXECUTABLE} ${gen_dts_cmake_script}
47154716
--edt-pickle ${arg_EDT_PICKLE_FILE}
4716-
--cmake-out ${gen_dts_cmake_output}
4717+
--cmake-out ${gen_dts_cmake_temp}
47174718
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
47184719
RESULT_VARIABLE ret
47194720
COMMAND_ERROR_IS_FATAL ANY
47204721
)
4722+
4723+
file(COPY_FILE ${gen_dts_cmake_temp} ${gen_dts_cmake_output} ONLY_IF_DIFFERENT)
47214724
endif()
47224725
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${gen_dts_cmake_script})
47234726

0 commit comments

Comments
 (0)