Skip to content

Commit

Permalink
CMake: Allow using symlinks for installed files. (FreeCAD#19043)
Browse files Browse the repository at this point in the history
* CMake: Allow using symlinks for installed files.
  • Loading branch information
tritao authored Jan 21, 2025
1 parent a1f5d36 commit 97d4c95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion cMake/FreeCadMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 97d4c95

Please sign in to comment.