Copy DLLs to appropriate dir for install-less Windows testing

Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
This commit is contained in:
ISSOtm
2026-04-03 21:08:24 +02:00
committed by Eldred Habert
parent c3b47abcc8
commit a5be1d886e
2 changed files with 16 additions and 4 deletions
+10 -4
View File
@@ -9,8 +9,15 @@ add_executable(rgbgfx_test gfx/rgbgfx_test.cpp)
set_target_properties(randtilegen rgbgfx_test PROPERTIES
# hack for MSVC: no-op generator expression to stop generation of "per-configuration subdirectory"
RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_SOURCE_DIR}/gfx>)
target_link_libraries(randtilegen PRIVATE PNG::PNG)
target_link_libraries(rgbgfx_test PRIVATE PNG::PNG)
foreach(prog "randtilegen" "rgbgfx_test")
target_link_libraries(${prog} PRIVATE PNG::PNG)
# Copy the DLLs in the output directory so the program can be run for testing without having to `install`.
# From https://cmake.org/cmake/help/v4.3/manual/cmake-generator-expressions.7.html#genex:TARGET_RUNTIME_DLLS.
add_custom_command(TARGET ${prog} POST_BUILD COMMENT "Copying ${prog}'s DLLs"
# It would be nice to symlink instead, but that only supports one file at a time.
COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:${prog}> $<TARGET_RUNTIME_DLLS:${prog}>
COMMAND_EXPAND_LISTS VERBATIM)
endforeach()
set(ONLY_FREE)
if(NOT TESTS_RUN_NONFREE)
@@ -31,5 +38,4 @@ configure_file(CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake @ONLY)
add_test(NAME all
COMMAND ./run-tests.sh ${ONLY_FREE} ${ONLY_INTERNAL} ${OS_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})