CMake: Allow using symlinks for installed files. (#19043)
* CMake: Allow using symlinks for installed files.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user