cmake-conan
cmake-conan copied to clipboard
support installing conan libraries along with the project
i.e. we would like to build conan libraries shared and install them along with the project. including proper rpath patching. that way the libraries when using cpack would end up in the package. now when we build shared the resulting executables depend on files in ~/.conan, which will not be present on the deployed-to machines. is this possible?
Hi @maddanio, Have you tried to use imports ? Maybe doing something like:
set ( CONANIMPORTS
"bin, *.dll -> ./bin"
"lib, *.lib -> ./lib"
)
include(conan.cmake)
message("${CMAKE_BUILD_TYPE}")
conan_cmake_run(REQUIRES zlib/1.2.8
IMPORTS ${CONANIMPORTS}
BASIC_SETUP CMAKE_TARGETS
BUILD missing)
add_executable(main main.cpp)
target_link_libraries(main CONAN_PKG::zlib)
Please tell me if this helps.
conanfile.txt have an own [imports] section. Can't we make use of this, instead of having to list imports in the CMake file? 🤔
Having a quick look into the source, yes, it should be possible.
I can't get even one of both variants to work for some reason
My imports work when executing conan install . in the terminal, but I can't get it working through CMake