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 bff245daef
commit 16295d4121
7 changed files with 82 additions and 59 deletions

View File

@@ -112,12 +112,18 @@ SOURCE_GROUP("shiputils" FILES ${ShipUtils_SRCS})
SET(all_files ${ShipMain_SRCS} ${ShipExamples_SRCS} ${ShipLoadExample_SRCS} ${ShipCreateShip_SRCS} ${ShipOutlineDraw_SRCS} ${ShipAreasCurve_SRCS} ${ShipHydrostatics_SRCS} ${ShipCreateWeight_SRCS} ${ShipCreateTank_SRCS} ${ShipCapacityCurve_SRCS} ${ShipCreateLoadCondition_SRCS} ${ShipGZ_SRCS} ${ShipUtils_SRCS})
SET(ShipGuiIcon_SVG
resources/icons/ShipWorkbench.svg
)
ADD_CUSTOM_TARGET(Ship ALL
SOURCES ${all_files} ${Ship_QRC_SRCS}
SOURCES ${all_files} ${Ship_QRC_SRCS} ${ShipGuiIcon_SVG}
)
fc_copy_sources(Ship "${CMAKE_BINARY_DIR}/Mod/Ship" ${all_files})
fc_copy_sources(Ship "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Ship" ${ShipGuiIcon_SVG})
IF(BUILD_GUI)
fc_target_copy_resource(Ship
${CMAKE_CURRENT_BINARY_DIR}
@@ -204,11 +210,10 @@ INSTALL(
DESTINATION
Mod/Ship
)
SET(ShipGuiIcon_SVG
resources/icons/ShipWorkbench.svg
INSTALL(
FILES
${ShipGuiIcon_SVG}
DESTINATION
"${CMAKE_INSTALL_DATADIR}/Mod/Ship/resources/icons"
)
fc_copy_sources(Ship "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Ship" ${ShipGuiIcon_SVG})
INSTALL(FILES ${ShipGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/Ship/resources/icons")