Skip to content

Instantly share code, notes, and snippets.

@byBretema
Created October 20, 2021 15:46
Show Gist options
  • Save byBretema/16adcd42ebd420af392967cc5a51629c to your computer and use it in GitHub Desktop.
Save byBretema/16adcd42ebd420af392967cc5a51629c to your computer and use it in GitHub Desktop.
function(COPY_FROM_TO_DIR src_dir dst_dir)
file(GLOB src_files ${src_dir}/*)
foreach(src_file IN LISTS src_files)
get_filename_component(file_and_ext ${src_file} NAME)
set(dst_file ${dst_dir}/${file_and_ext})
# MESSAGE(STATUS "[[[COPY_FROM_TO_DIR]]] :\n * ${src_file}\n * ${dst_file}")
# add_custom_command(COMMAND ${CMAKE_COMMAND} -E make_directory ${dst_dir} OUTPUT ${dst_dir})
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${src_file} ${dst_file}
)
endforeach()
endfunction()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment