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
+6
View File
@@ -108,6 +108,12 @@ set_target_properties(rgbasm rgblink rgbfix rgbgfx PROPERTIES
# The generator expression (even if a no-op) stops muti-config generators using a of "per-configuration subdirectory".
RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_SOURCE_DIR}>)
target_link_libraries(rgbgfx 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 rgbgfx POST_BUILD COMMENT "Copying rgbgfx'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:rgbgfx> $<TARGET_RUNTIME_DLLS:rgbgfx>
COMMAND_EXPAND_LISTS VERBATIM)
# On Windows, you don't link against DLLs directly, but against an import library for that DLL.
# This leads to, sometimes, the DLL being stored in a directory far away from the import library itself!