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

@@ -56,12 +56,17 @@ SET(Arch_presets
SOURCE_GROUP("" FILES ${Arch_SRCS})
SET(ArchGuiIcon_SVG
Resources/icons/ArchWorkbench.svg
)
ADD_CUSTOM_TARGET(Arch ALL
SOURCES ${Arch_SRCS} ${Arch_QRC_SRCS}
SOURCES ${Arch_SRCS} ${Arch_QRC_SRCS} ${Dice3DS_SRCS} ${Arch_presets} ${ArchGuiIcon_SVG}
)
fc_copy_sources(Arch "${CMAKE_BINARY_DIR}/Mod/Arch" ${Arch_SRCS})
fc_copy_sources(Arch "${CMAKE_BINARY_DIR}/Mod/Arch" ${Dice3DS_SRCS})
fc_copy_sources(Arch "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Arch" ${ArchGuiIcon_SVG})
fc_target_copy_resource(Arch
${CMAKE_SOURCE_DIR}/src/Mod/Arch
@@ -88,7 +93,6 @@ INSTALL(
${Dice3DS_SRCS}
DESTINATION Mod/Arch/Dice3DS
)
INSTALL(
DIRECTORY
Presets
@@ -96,11 +100,10 @@ INSTALL(
${CMAKE_INSTALL_DATADIR}/Mod/Arch
FILES_MATCHING PATTERN "*.csv*"
)
SET(ArchGuiIcon_SVG
Resources/icons/ArchWorkbench.svg
INSTALL(
FILES
${ArchGuiIcon_SVG}
DESTINATION
"${CMAKE_INSTALL_DATADIR}/Mod/Arch/Resources/icons"
)
fc_copy_sources(Arch "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Arch" ${ArchGuiIcon_SVG})
INSTALL(FILES ${ArchGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/Arch/Resources/icons")