diff --git a/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake b/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake index 9ebfaef1ba..323f4be936 100644 --- a/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake +++ b/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake @@ -15,6 +15,7 @@ macro(InitializeFreeCADBuildOptions) option(BUILD_WITH_CONDA "Set ON if you build FreeCAD with conda" OFF) option(BUILD_DYNAMIC_LINK_PYTHON "If OFF extension-modules do not link against python-libraries" ON) option(INSTALL_TO_SITEPACKAGES "If ON the freecad root namespace (python) is installed into python's site-packages" ON) + option(INSTALL_PREFER_SYMLINKS "If ON then fc_copy_sources macro will create symlinks instead of copying files" OFF) option(OCCT_CMAKE_FALLBACK "disable usage of occt-config files" OFF) if (WIN32 OR APPLE) option(FREECAD_USE_QT_FILEDIALOG "Use Qt's file dialog instead of the native one." OFF) diff --git a/cMake/FreeCadMacros.cmake b/cMake/FreeCadMacros.cmake index f5efcdefe6..351909a1b1 100644 --- a/cMake/FreeCadMacros.cmake +++ b/cMake/FreeCadMacros.cmake @@ -9,12 +9,18 @@ MACRO (fc_copy_sources target_name outpath) else() set(fc_details "") endif() + if(INSTALL_PREFER_SYMLINKS) + set(copy_command create_symlink) + else() + set(copy_command copy) + endif() + foreach(it ${ARGN}) get_filename_component(infile ${it} ABSOLUTE) get_filename_component(outfile "${outpath}/${it}" ABSOLUTE) add_file_dependencies("${infile}" "${outfile}") ADD_CUSTOM_COMMAND( - COMMAND "${CMAKE_COMMAND}" -E copy "${infile}" "${outfile}" + COMMAND "${CMAKE_COMMAND}" -E ${copy_command} "${infile}" "${outfile}" OUTPUT "${outfile}" COMMENT "Copying ${infile} to ${outfile}${fc_details}" MAIN_DEPENDENCY "${infile}"