CMake 2.8.12 and lower allowed the SOURCE signature in add_custom_command

In CMake 3.0 the policy CMP0050 was introduced where it could be set to OLD to keep this behaviour while for NEW an error was raised.
Since CMake 3.5.2 a warning comes up when using the OLD behaviour and that it will be removed in a future version.

In FreeCAD we switched to the new behaviour now and removed the SOURCE signature from add_custom_command which affects the macros
fc_copy_sources, fc_target_copy_resource and fc_target_copy_resource_flat and their usage.
It's not possible any more to add files to a target by using the macros. Now a file must be added to the target before using the macros.

This commit fixes it for Arch, Draft, OpenSCAD, Material, Plot and Ship
This commit is contained in:
wmayer
2018-08-20 11:47:39 +02:00
parent 52a5c4aafd
commit 8088aa159f
7 changed files with 82 additions and 59 deletions

View File

@@ -52,12 +52,18 @@ SOURCE_GROUP("plotutils" FILES ${PlotUtils_SRCS})
SET(all_files ${PlotMain_SRCS} ${PlotAxes_SRCS} ${PlotLabels_SRCS} ${PlotPositions_SRCS} ${PlotSave_SRCS} ${PlotSeries_SRCS} ${PlotUtils_SRCS})
SET(PlotGuiIcon_SVG
resources/icons/PlotWorkbench.svg
)
ADD_CUSTOM_TARGET(Plot ALL
SOURCES ${all_files} ${Plot_QRC_SRCS}
SOURCES ${all_files} ${Plot_QRC_SRCS} ${PlotGuiIcon_SVG}
)
fc_copy_sources(Plot "${CMAKE_BINARY_DIR}/Mod/Plot" ${all_files})
fc_copy_sources(Plot "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Plot" ${PlotGuiIcon_SVG})
IF (BUILD_GUI)
fc_target_copy_resource(Plot
${CMAKE_CURRENT_BINARY_DIR}
@@ -108,11 +114,9 @@ INSTALL(
DESTINATION
Mod/Plot
)
SET(PlotGuiIcon_SVG
resources/icons/PlotWorkbench.svg
INSTALL(
FILES
${PlotGuiIcon_SVG}
DESTINATION
"${CMAKE_INSTALL_DATADIR}/Mod/Plot/resources/icons"
)
fc_copy_sources(Plot "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Plot" ${PlotGuiIcon_SVG})
INSTALL(FILES ${PlotGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/Plot/resources/icons")