From 4ffc6c28829c5d315bc3a5396c40659e60e14292 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 15 Jun 2018 11:49:39 -0500 Subject: [PATCH] Clean up and improve fc_copy_sources and fc_target_copy_resource CMake macros The previous steps of TO_NATIVE_PATH followed by ABSOLUTE is not meaningful or reliable: output of ABSOLUTE is always in "cmake" path format, not native path format. Native path input to CMake commands may not do what you want. --- cMake/FreeCadMacros.cmake | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/cMake/FreeCadMacros.cmake b/cMake/FreeCadMacros.cmake index 7680a808e9..3ac60b1845 100644 --- a/cMake/FreeCadMacros.cmake +++ b/cMake/FreeCadMacros.cmake @@ -42,16 +42,14 @@ ENDMACRO(COPY_IF_DIFFERENT FROM_DIR TO_DIR FILES TARGETS TAGS) MACRO (fc_copy_sources target_name outpath) foreach(it ${ARGN}) - file(TO_NATIVE_PATH "${outpath}/${it}" outfile) get_filename_component(infile ${it} ABSOLUTE) - get_filename_component(outfile ${outfile} ABSOLUTE) - add_file_dependencies(${infile} ${outfile}) + get_filename_component(outfile "${outpath}/${it}" ABSOLUTE) + add_file_dependencies("${infile}" "${outfile}") ADD_CUSTOM_COMMAND( - SOURCE ${infile} - COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${infile} ${outfile} + SOURCE "${infile}" + COMMAND "${CMAKE_COMMAND}" -E copy "${infile}" "${outfile}" TARGET ${target_name} - OUTPUTS ${outfile} + OUTPUTS "${outfile}" ) endforeach(it) ADD_CUSTOM_COMMAND( @@ -63,17 +61,14 @@ ENDMACRO(fc_copy_sources) MACRO (fc_target_copy_resource target_name inpath outpath) foreach(it ${ARGN}) - file(TO_NATIVE_PATH "${inpath}/${it}" infile) - file(TO_NATIVE_PATH "${outpath}/${it}" outfile) - get_filename_component(infile ${infile} ABSOLUTE) - get_filename_component(outfile ${outfile} ABSOLUTE) - add_file_dependencies(${infile} ${outfile}) + get_filename_component(infile "${inpath}/${it}" ABSOLUTE) + get_filename_component(outfile "${outpath}/${it}" ABSOLUTE) + add_file_dependencies("${infile}" "${outfile}") ADD_CUSTOM_COMMAND( - SOURCE ${infile} - COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${infile} ${outfile} + SOURCE "${infile}" + COMMAND "${CMAKE_COMMAND}" -E copy "${infile}" "${outfile}" TARGET ${target_name} - OUTPUTS ${outfile} + OUTPUTS "${outfile}" ) endforeach(it) ADD_CUSTOM_COMMAND(