-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCopyToOutput.cmake
54 lines (50 loc) · 2.37 KB
/
CopyToOutput.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#########################################################
# Copy local file to output directory of specified target
# Usage:
# include(CopyToOutput)
# copy_local_file_to_output_prebuild(target-name settings.xml)
macro (copy_local_file_to_output_prebuild target_name local_file_name)
add_custom_command(
TARGET ${target_name} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${local_file_name} $<TARGET_FILE_DIR:${target_name}>)
endmacro()
#########################################################
# Copy file to output directory of specified target
# Usage:
# include(CopyToOutput)
# copy_file_to_output_prebuild(target-name ${FullPathToFile}/settings.xml)
macro (copy_file_to_output_prebuild target_name file_name)
add_custom_command(
TARGET ${target_name} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${file_name} $<TARGET_FILE_DIR:${target_name}>)
endmacro()
#########################################################
# Copy local file to output directory of specified target
# Usage:
# include(CopyToOutput)
# copy_local_file_to_output_postbuild(target-name settings.xml)
macro (copy_local_file_to_output_postbuild target_name local_file_name)
add_custom_command(
TARGET ${target_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${local_file_name} $<TARGET_FILE_DIR:${target_name}>)
endmacro()
#########################################################
# Copy file to output directory of specified target
# Usage:
# include(CopyToOutput)
# copy_file_to_output_postbuild(target-name ${FullPathToFile}/settings.xml)
macro (copy_file_to_output_postbuild target_name file_name)
add_custom_command(
TARGET ${target_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${file_name} $<TARGET_FILE_DIR:${target_name}>)
endmacro()
#########################################################
# Try copy directory to output directory
# Usage:
# include(CopyToOutput)
# copy_directory_to_output(target-name ${FullPathToDirectory})
macro (copy_directory_to_output target_name source_directory destination_relative_directory)
add_custom_command(TARGET ${target_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${source_directory} $<TARGET_FILE_DIR:${target_name}>/${destination_relative_directory})
endmacro()