Conan and CMake find_package
Unsolved
Installation and Deployment
-
Hi! I've decided to give Qt with Conan a shot since I'm using conan already. I noticed some oddities that I'm not too sure about though.
Normally, when I use Qt, I have something along the lines of:
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
...inside of CMakeLists.txt. This doesn't seem to work with the Conan module. In order to get Widgets, I download the qtbase package which doesn't output a Qt6 find module or config script. So in order to get this to work, I'm having to do:
find_package(qtbase REQUIRED) find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
I'm just wondering if this is the intended use of this. For reference is my conanfile.py below:
from conans import ConanFile from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake class App(ConanFile): settings = "os", "arch", "compiler", "build_type" tool_requires = ( "cmake/3.22.3" ) requires = ( "qtbase/6.2.3@qt/everywhere" ) def generate(self): deps = CMakeDeps(self) deps.generate() tc = CMakeToolchain(self) tc.generate() def build(self): cmake = CMake(self) cmake.configure() cmake.build()
Aside from that, everything seems to work okay with minimal examples.
-