conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
975 stars 1.79k forks source link

[package] Qt/5.15.2: Cmake doesn't export the versionless targets #6459

Open tcanabrava opened 3 years ago

tcanabrava commented 3 years ago

This is important for Qt5 / 6 compatibility.

https://doc-snapshots.qt.io/qt6-dev/cmake-qt5-and-qt6-compatibility.html

CMake Error at cmake/AddDualTargetLibrary.cmake:61 (add_library): Target "tet_exec" links to target "Qt::Gui" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? Call Stack (most recent call first): CMakeLists.txt:5

Steps to reproduce (Include if Applicable)

Create a Qt5 project for cmake. Use the versionless Target:

add_executable(test main.cpp) target_link_libraries(test Qt::Core)

tcanabrava commented 3 years ago

This also affects Qt6

ericLemanissier commented 3 years ago

I think conan is not able to generate targets in several namespaces : https://docs.conan.io/en/latest/reference/generators/cmake_find_package.html It may be already reported in conan-io/conan. If not, it's worth reporting.

SpaceIm commented 3 years ago

I forgot to answer to this thread: you can emulate any target with a custom CMake module created at package() time, and added to build_modules in package_info(). It's tedious, but it works.

Most recipes using this trick create non namespaced targets, but you can perfectly create custom namespaced targets. Take a look at openexr recipe: https://github.com/conan-io/conan-center-index/blob/e1d9d8ec8940d759582f8609f08addec1de7b77d/recipes/openexr/2.x/conanfile.py#L98-L226

perseoGI commented 2 months ago

Hi there, I was reviewing old issues and I have come across this one. The qt/5.15.2 version is no longer supported by Conan Center Index.

I'm closing this issue as this recipe has suffer plenty of modifications since this issue was reported. If for some reason the problem remains nowadays, do not hesitate to reopen this issue or create a new ticket with updated information, preferably using conan v2.

Happy coding 🐸

SpaceIm commented 2 months ago

@perseoGI I think it should not be closed, this issue has not been fixed.

SpaceIm commented 2 months ago

I've opened https://github.com/conan-io/conan-center-index/pull/25198

perseoGI commented 2 months ago

Okey thanks for opening an updated issue!

SpaceIm commented 2 months ago

It's not an updated issue but a PR fixing this issue.

perseoGI commented 2 months ago

My sorry, really early in the morning hehe, thanks for your contribution @SpaceIm