Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmake_paths generator broken for transitive dependencies #4467
The cmake_paths generator currently doesn't handle transitive dependencies for Conan packages. I am not talking about the requires option, but for transitive dependencies in a package itself.
Consider the following simple conanfile.txt configuration:
Since the cmake_paths generator only declares the
If a client doesn't add the
A rather simple and appropriate fix to this would be to extend the cmake_paths generator with all those custom and necessary
# as before set(CMAKE_MODULE_PATH ...) set(CMAKE_PREFIX_PATH ...) # new and mandatory for transitive package dependencies set(CONAN_LIBJPEG_ROOT ...) set(CONAN_ZLIB_ROOT ...) set(CONAN_LIBPNG_ROOT ...) set(CONAN_LIBTIFF_ROOT) ...
Since the paths to those transitive dependencies already get appended to the
Please let me know, if I am doing something wrong here, or if the proposed solution is feasible.
I'm not sure I understand.
No, this is exactly what I want to avoid, since I don't want my package manager to interfere with my build system configuration. I've set up a working example on this issue here .
In a nutshell:
Since, the OpenCV package itself depends on other dependencies such as libjpeg, zlib etc. it needs to be pointed to the dependencies Conan has already downloaded and cached for exactly this package.
Typically, this is done via CMake calls to
I think, I've demonstrated a very simple use case of Conan where I have a small CMake-based project with a single dependency and want to use Conan in a non-intrusive way. Currently this is not possible. CMake's
This commit fixes an issue when using the cmake_paths generator with packages that itself have one or more transitive package dependencies. Currently only the CMake variables CMAKE_MODULE_PATH and CMAKE_PREFIX_PATH get populated in the conan_paths.cmake toolchain file. However, this information is not sufficient for packages that have been generated using the cmake generator as they may use Conan specific variables in the form of CONAN_*_ROOT that are populated with the paths pointing to its own, transitive dependencies. Since this information is already stored in |DepsCppCmake| when creating the conan_paths.cmake toolchain file, this commit just populates the custom Conan variables in this file as well.