CMake: Copy assets to the build directory automatically

This commit is contained in:
Riyyi
2022-09-27 12:12:03 +02:00
parent 85b222984d
commit 17e3a8a5eb
3 changed files with 9 additions and 0 deletions
+7
View File
@@ -66,6 +66,13 @@ add_subdirectory("vendor")
# Add engine target to project
add_subdirectory("src")
# ------------------------------------------
# Assets target
add_custom_target(${ENGINE}-assets ALL
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/copy-assets.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# ------------------------------------------
# Examples target
+1
View File
@@ -0,0 +1 @@
file(COPY ${CMAKE_CURRENT_LIST_DIR}/../assets DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+1
View File
@@ -25,4 +25,5 @@ target_precompile_headers(${GAME} REUSE_FROM ${ENGINE})
# Add 'make run' target
add_custom_target(run
COMMAND ${GAME}
WORKING_DIRECTORY ".."
)