From e5a1a9d35a77c3904b6079de02eb4d31840ab6ba Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 21 Aug 2018 13:52:42 +0200 Subject: [PATCH] macro to check for different input and output file and if needed replace output file --- cMake/FreeCadMacros.cmake | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 -