Open Todiq opened 1 month ago
According to CMake documentation: https://cmake.org/cmake/help/latest/command/file.html#get-runtime-dependencies
if beta.exe depends on beteaimpl.dll, and they are in the same directory, it should have considered that directory already so it should be resolved. Although I wonder if it's looking in the installed location or the original location - if it's the location from the build tree, it may in a different folder.
You may have some luck doing any of the following:
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
near the top in the top-level cmakelists.txt - to cause all .dll and .exe to end up in the same directoryOR
something like $<TARGET_FILE_DIR:betaimpl>
, e.g:
install(RUNTIME_DEPENDENCY_SET my_app_deps
PRE_EXCLUDE_REGEXES
[=[api-ms-]=]
[=[ext-ms-]=]
[[kernel32\.dll]]
[[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]]
POST_EXCLUDE_REGEXES
[=[.*system32\/.*\.dll]=]
[=[^\/(lib|usr\/lib|usr\/local\/lib)]=]
DIRECTORIES ${CONAN_RUNTIME_LIB_DIRS} $<TARGET_FILE_DIR:betaimpl>
)
Don't think this is a Conan bug - although I think it would be useful to clarify in our documentation that more work needs to be done to ensure cmake
I'm unsure, but as a third option you may want to add the target for betaimpl to the install(TARGETS...)
in the top level file and that might work - or might cause cmake to complain a file already exists.
@jcar87
You are right, you are supposed to install every target you require in the final package and not let cmake resolve that automatically for you: https://gitlab.kitware.com/cmake/cmake/-/issues/22987
I added
install(TARGETS ${PROJECT_NAME}
RUNTIME_DEPENDENCY_SET my_app_deps
DESTINATION ${DEPS_DESTINATION}
)
to the CMakeLists.txt
of betaimpl
, but that still leads to the same issue.
The only way to resolve that error is to not write install(RUNTIME_DEPENDENCY_SET my_app_deps
and do simpler target installs: install(TARGETS ${PROJECT_NAME})
Since removing DIRECTORIES ${CONAN_RUNTIME_LIB_DIRS}
from the install(RUNTIME_DEPENDENCY_SET my_app_deps
block does not fix anything either (as a matter of fact, it does make things worse since cmake won't find the third parties dependencies), we can indeed conclude that it is not a conan bug. I am thus closing the ticket.
Thanks for your clarifications!
@jcar87
I fixed the example and on Windows, we can observe that libxml2.dll is not installed, while it is on Linux. Could you please have a look?
What is your question?
Related to https://github.com/conan-io/conan/issues/16726
Please clone https://github.com/Todiq/test_conan
On windows with msvc installed, run
python build.py
I am getting the following error:
This behaviour will happen even if the following block is added to the
CMakeLists.txt
of thebetaimpl
lib:Removing the same code from the
CMakeLists.txt
ofbeta
(executable) successfully installsbetaimpl.dll
, but notbeta.exe
anymore.Linux behaves the same, but does not throw a cmake error. Can anyone give me a hand? Thanks in advance!
Have you read the CONTRIBUTING guide?