forked from NVIDIAGameWorks/Flow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCopyAsset.cmake
27 lines (27 loc) · 1 KB
/
CopyAsset.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
# copy asset file from source directory to binary directory.
function(copy_assets asset_files dir_name copied_files)
foreach(asset ${asset_files})
#message("asset: ${asset}")
get_filename_component(file_name ${asset} NAME)
get_filename_component(full_path ${asset} ABSOLUTE)
set(output_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${dir_name})
set(output_file ${output_dir}/${file_name})
set(${copied_files} ${${copied_files}} ${output_file})
set(${copied_files} ${${copied_files}} PARENT_SCOPE)
set_source_files_properties(${asset} PROPERTIES HEADER_FILE_ONLY TRUE)
if (WIN32)
add_custom_command(
OUTPUT ${output_file}
#COMMAND mklink \"${output_file}\" \"${full_path}\"
COMMAND xcopy \"${full_path}\" \"${output_file}*\" /Y /Q /F
DEPENDS ${full_path}
)
else()
add_custom_command(
OUTPUT ${output_file}
COMMAND mkdir --parents ${output_dir} && cp --force --link \"${full_path}\" \"${output_file}\"
DEPENDS ${full_path}
)
endif()
endforeach()
endfunction()