diff --git a/cMake/FreeCadMacros.cmake b/cMake/FreeCadMacros.cmake index 87713b904a..aaa1c0af2b 100644 --- a/cMake/FreeCadMacros.cmake +++ b/cMake/FreeCadMacros.cmake @@ -26,6 +26,26 @@ MACRO (fc_copy_sources target_name outpath) ) ENDMACRO(fc_copy_sources) +MACRO (fc_copy_file_if_different inputfile outputfile) + if (EXISTS ${outputfile}) + execute_process( + COMMAND ${CMAKE_COMMAND} -E compare_files ${inputfile} + ${outputfile} + RESULT_VARIABLE DIFFERENT_FILES + OUTPUT_QUIET + ERROR_QUIET + ) + + if (DIFFERENT_FILES) + execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${inputfile}" + "${outputfile}") + endif() + else() + execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${inputfile}" + "${outputfile}") + endif() +ENDMACRO(fc_copy_file_if_different) + MACRO (fc_target_copy_resource target_name inpath outpath) # Macro to copy a list of files into a nested directory structure # Arguments -