2016-01-12 21:04:11 +00:00
|
|
|
function(copy_and_install sourceGlob relativeTargetDirectory)
|
2015-12-21 07:23:01 +00:00
|
|
|
# Set `sourcePaths`
|
|
|
|
file(GLOB sourcePaths "${sourceGlob}")
|
|
|
|
|
|
|
|
foreach(sourcePath ${sourcePaths})
|
|
|
|
# Set `fileName`
|
|
|
|
get_filename_component(fileName "${sourcePath}" NAME)
|
|
|
|
|
2016-01-12 21:04:11 +00:00
|
|
|
# Copy file during build
|
2015-12-21 07:23:01 +00:00
|
|
|
add_custom_command(TARGET rhubarb POST_BUILD
|
2016-01-12 21:04:11 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${sourcePath}" "$<TARGET_FILE_DIR:rhubarb>/${relativeTargetDirectory}/${fileName}"
|
2015-12-21 07:23:01 +00:00
|
|
|
COMMENT "Creating '${relativeTargetDirectory}/${fileName}'"
|
|
|
|
)
|
2016-01-12 21:04:11 +00:00
|
|
|
|
|
|
|
# Install file
|
|
|
|
install(
|
|
|
|
FILES "${sourcePath}"
|
|
|
|
DESTINATION "${relativeTargetDirectory}"
|
|
|
|
)
|
2015-12-21 07:23:01 +00:00
|
|
|
endforeach()
|
|
|
|
endfunction()
|