From 37ce49b00167a662f4b29e0154ca7945b0cbf8b4 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Jul 2020 14:11:16 +0200 Subject: [PATCH] CMake: stop overwriting branding settings in the build dir - Only copy over branding files if they are newer Typically I have KDevelop open while working on Calamares; if I am editing settings in `branding.desc` in the build directory, then every time KDevelop runs CMake in the background, my changes (for testing branding things!) would be overwritten. Don't do that. For normal builds with a clean build directory, this doesn't change anything since the target is missing; changing a file in the source directory **will** copy it over the build directory version. --- CMakeModules/CalamaresAddBrandingSubdirectory.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeModules/CalamaresAddBrandingSubdirectory.cmake b/CMakeModules/CalamaresAddBrandingSubdirectory.cmake index 9283b48a7..70fcd9279 100644 --- a/CMakeModules/CalamaresAddBrandingSubdirectory.cmake +++ b/CMakeModules/CalamaresAddBrandingSubdirectory.cmake @@ -70,7 +70,11 @@ function( calamares_add_branding NAME ) foreach( BRANDING_COMPONENT_FILE ${BRANDING_COMPONENT_FILES} ) set( _subpath ${_brand_dir}/${BRANDING_COMPONENT_FILE} ) if( NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_subpath} ) - configure_file( ${_subpath} ${_subpath} COPYONLY ) + set( _src ${CMAKE_CURRENT_SOURCE_DIR}/${_subpath} ) + set( _dst ${CMAKE_CURRENT_BINARY_DIR}/${_subpath} ) + if( ${_src} IS_NEWER_THAN ${_dst} ) + configure_file( ${_src} ${_dst} COPYONLY ) + endif() install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_subpath} DESTINATION ${BRANDING_COMPONENT_DESTINATION}/${_subdir}/ )