Skip to content

Instantly share code, notes, and snippets.

@kwsp
Last active December 31, 2024 23:27
Show Gist options
  • Save kwsp/e9f1439c14f9c7ea449c090c8d11e805 to your computer and use it in GitHub Desktop.
Save kwsp/e9f1439c14f9c7ea449c090c8d11e805 to your computer and use it in GitHub Desktop.
Copy resources from source dir to CMake multi-config build directory
function(copy_to_target_dir target resource)
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"$<TARGET_PROPERTY:${target},SOURCE_DIR>/${resource}"
"$<TARGET_FILE_DIR:${target}>/${resource}"
)
endfunction()
copy_to_target_dir(${EXE_NAME} shaders)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment