# How to use TARGET\_RUNTIME\_DLLS with find\_package DLL of UNKNOWN type

**URL:** https://discourse.cmake.org/t/how-to-use-target-runtime-dlls-with-find-package-dll-of-unknown-type/14986
**Category:** Usage
**Tags:** os:windows
**Created:** [August 11, 2025, 1:24pm UTC](https://discourse.cmake.org/t/how-to-use-target-runtime-dlls-with-find-package-dll-of-unknown-type/14986 "2025-08-11T13:24:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Gornhoth](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gornhoth/32/4998_2.png) [@Gornhoth](https://discourse.cmake.org/u/Gornhoth)
#### Post date: [August 11, 2025, 1:24pm UTC](https://discourse.cmake.org/t/how-to-use-target-runtime-dlls-with-find-package-dll-of-unknown-type/14986/1 "2025-08-11T13:24:00Z")

</div>

I am using vcpkg on windows to add openssl and use it for a DLL target A which I then link against with executable B. This causes a well-known issue about A and its dependencies not being put into B’s output directory when building. Now I understand why this happens, I have read the documentation and the numerous issues that have been opened regarding this problem but I am yet to find the best practice on how to actually work around the limitations and achieve the desired behaviour where the output directory of executable B contains B.exe, A.dll and A’s openssl dll dependencies (eg in my case libcrypto and libssl dlls) after building. For reference, here is the relevant cmake code:

```auto
# root/libraryA/CMakeLists.txt
find_package(OpenSSL REQUIRED)
add_library(A SHARED)
target_sources(...)
target_include_directories(A PUBLIC ${OPENSSL_INCLUDE_DIR})
target_link_libraries(A PUBLIC OpenSSL::SSL OpenSSL::Crypto)

# root/executableB/CMakeLists.txt
add_executable(B B.cpp)
target_link_libraries(B PUBLIC A)

```

What is the recommended way of adding A and its dependencies to the output build folder of B?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [August 11, 2025, 1:29pm UTC](https://discourse.cmake.org/t/how-to-use-target-runtime-dlls-with-find-package-dll-of-unknown-type/14986/2 "2025-08-11T13:29:21Z")

</div>

IMO, the long-term path is to finish [https://gitlab.kitware.com/cmake/cmake/-/merge\_requests/5820](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5820) and then have find modules detect shared vs static libraries for the paths they provide.

Doesn’t help with the immediate issue though, sorry.
