conan icon indicating copy to clipboard operation
conan copied to clipboard

[bug] Can't set GLOBAL visibility for imported targets

Open mpusz opened this issue 1 year ago • 2 comments

Environment details

  • Operating System+version:
  • Compiler+version:
  • Conan version: 2.0.17
  • Python version:

Steps to reproduce

  1. Make a simple CMake project with one subdirectory (two CMakeLists.txt files).
  2. The outer one should do add_subdirectory() on the lower one.
  3. Do find_package(<package_name> GLOBAL) in the inner CMake file
  4. 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

mpusz avatar Feb 13 '24 20:02 mpusz

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.

jcar87 avatar Feb 14 '24 09:02 jcar87

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.

mpusz avatar Feb 14 '24 16:02 mpusz