question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] CMake generator does not allow multiple namespaces for the exported library.

See original GitHub issue

This affects at least Qt5, Qt6 and most of the libraries on the KDE Frameworks. I’d assume more libraries use this but those are the ones I have to work on daily.

Qt5 exports Qt:: and Qt5:: namespaces, qt6 exports Qt:: and Qt6:: namespaces on their original find modules, and it’s important that we can rely on this for the generated find modules, so that code made for both Qt5 and Qt6 works.

I’m new to conan but I’m quite interested in improving it.

my proposal is to add a metadata on the recipe of such modules:

lass QtConan(ConanFile):
    generators = "pkg_config", "cmake_find_package", "cmake"
    name = "qt"
    cmake_find_package_namespaces = ["Qt", "Qt6"]

and when we run the cmake_find_package generator, we iterate trougth that list, and generate everything for all the cases.

conan-center related issue: https://github.com/conan-io/conan-center-index/issues/6459

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
SpaceImcommented, Dec 16, 2021

@czoido the new cmake_target_name logic fixes this issue I think.

1reaction
tcanabravacommented, Aug 3, 2021

Yes I would. give me a couple of days to familiarize with the codebase.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems with exported targets inside namespace which are ...
I stumbled upon an issue (newest CMake Version 3.14): Take this example where I am adding three libraries. All of them are exported...
Read more >
cmake-packages(7) — CMake 3.25.1 Documentation
A NAMESPACE with double-colons is specified when exporting the targets for installation. This convention of double-colons gives CMake a hint that the name...
Read more >
CMake: Best Practices
Build system generator. Understands the files you are building. System independent. You give relationships. Can find libraries, etc. CMake is two-stage; ...
Read more >
CMake: enforcing a relationship between namespaces and ...
It seems that CMake does not support defining a relationship between the namespace of an exported or installed target and the name of...
Read more >
Creating a C++ library with CMake - Declaration of VAR
Making a library with CMake is not that different from making an application - instead of add_executable you call add_library.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found