conan
conan copied to clipboard
[bug] Can't set GLOBAL visibility for imported targets
Environment details
- Operating System+version:
- Compiler+version:
- Conan version: 2.0.17
- Python version:
Steps to reproduce
- Make a simple CMake project with one subdirectory (two CMakeLists.txt files).
- The outer one should do
add_subdirectory()on the lower one. - Do
find_package(<package_name> GLOBAL)in the inner CMake file - Try to use the imported target in the outer CMake file
At least CMake 3.24 is needed. More details in https://cmake.org/cmake/help/latest/command/find_package.html#basic-signature.
Logs
No response
Hi @mpusz - thank you for reporting this.
Will investigate, as my understanding from reading the CMake documentation is that this should work transparently and that it doesn't need anything specific in the generated files by the CMakeDeps generator.
Right! It should be the case. But Conan generates different target types and more of them than the regular CMake installation process. It might be an issue.
BTW, recently I generated the graph with cmake --graphviz and was quite surprised to see so many Conan-generated targets there for each dependency.