I have a CMake project where I link with fmt::fmt
which is specified in the conanfile.py and installed and all cmake config files have been generated by Conan
and been used by CMake, so far all good. (I use from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake
I try to copy all transitive dependencies of my target tgt
with https://cmake.org/cmake/help/git-stage/manual/cmake-generator-expressions.7.html#genex:TARGET_RUNTIME_DLLS (I know about conan‘s import feature but I wanted to give it a try with CMake!)
add_executable(exe main.c)
target_link_libraries(exe PRIVATE otherTarget fmt::fmt)
add_custom_command(TARGET exe POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:exe> $<TARGET_FILE_DIR:exe>
COMMAND_EXPAND_LISTS
)
Strangely, the otherTarget.dll will be copyied to the Exe. But fmt::fmt dll
is not copied, because something is either wrongly setup in the generated files? Conan however sets IMPORTED_LOCATION to the .../lib/fmtd.lib
on the referencing targets of fmt::fmt
, and I suspect CMake does not include it in TARGET_RUNTIME_DLLS
because only .dll
files are treated?
Does anybody know whats going on here?