CMake: copy resources to build dir (linux+win)

This commit is contained in:
Jan Mrna
2025-10-16 10:55:08 +02:00
parent 935c74864c
commit e117e85e7f

View File

@@ -107,13 +107,6 @@ if(WIN32)
${GLEW_TARGET} ${GLEW_TARGET}
) )
# Copy resources after build (Windows only)
add_custom_command(TARGET pathfinding_demo POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/cpp/resources
$<TARGET_FILE_DIR:pathfinding_demo>/resources
)
# Add compile flags for Windows (vcpkg handles most of this automatically) # Add compile flags for Windows (vcpkg handles most of this automatically)
if(MSVC) if(MSVC)
if(SDL3_CFLAGS_OTHER) if(SDL3_CFLAGS_OTHER)
@@ -133,6 +126,14 @@ else()
target_compile_options(pathfinding_demo PRIVATE ${SDL3_CFLAGS_OTHER}) target_compile_options(pathfinding_demo PRIVATE ${SDL3_CFLAGS_OTHER})
endif() endif()
# Copy resources after build
add_custom_command(TARGET pathfinding_demo POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/cpp/resources
$<TARGET_FILE_DIR:pathfinding_demo>/resources
)
# Test executable # Test executable
add_executable(tests cpp/test/test.cpp) add_executable(tests cpp/test/test.cpp)
if(WIN32) if(WIN32)