Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Conan and CMake find_package
Forum Updated to NodeBB v4.3 + New Features

Conan and CMake find_package

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
2 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    computerquip
    wrote on last edited by computerquip
    #1

    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.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      phreed
      wrote on last edited by
      #2

      What is your conan profile?
      The following profile does not work for me.

      [settings]
      arch=x86_64
      arch_build=x86_64
      build_type=Debug
      compiler=gcc
      compiler.libcxx=libstdc++11
      compiler.version=9
      os=Linux
      os_build=Linux
      [options]
      [build_requires]
      [env]
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved