Skip to content

Commit 9c83e32

Browse files
committed
DLL copy test
1 parent c727fe9 commit 9c83e32

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

cmake/FindDependencyDLLs.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ function(find_and_copy_dependency_dlls)
88
return()
99
endif()
1010

11+
# Copy DLLs from all linked CMake targets (e.g. lazperf.dll built via
12+
# FetchContent). $<TARGET_RUNTIME_DLLS:tgt> lists every SHARED_LIBRARY the
13+
# target transitively depends on. Post-build steps are appended in order, so
14+
# this runs before the gtest_discover_tests step added later in
15+
# CMakeLists.txt.
16+
foreach(target ${ARGN})
17+
if(TARGET ${target})
18+
add_custom_command(
19+
TARGET ${target}
20+
POST_BUILD
21+
COMMAND
22+
powershell -NonInteractive -Command
23+
"$dllList = '$<JOIN:$<TARGET_RUNTIME_DLLS:${target}>,|>'; foreach ($dll in $dllList.Split('|')) { if ($dll) { Copy-Item -Path $dll -Destination '$<TARGET_FILE_DIR:${target}>' -Force -ErrorAction SilentlyContinue } }"
24+
COMMENT "Copying target runtime DLLs for ${target}"
25+
VERBATIM)
26+
endif()
27+
endforeach()
28+
1129
# For vcpkg builds, copy all DLLs from vcpkg's bin directory
1230
if(BLAZE_USE_VCPKG)
1331
if(DEFINED VCPKG_INSTALLED_DIR)

0 commit comments

Comments
 (0)