Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Building Qt6 manually from source
QtWS25 Last Chance

Building Qt6 manually from source

Scheduled Pinned Locked Moved Solved Qt 6
4 Posts 3 Posters 487 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.
  • D Offline
    D Offline
    daedelus1996
    wrote on last edited by
    #1

    I have a project that I am using cmake to build. I only need QtBase for my project and want to build only it. I'd rather have the source in my tree. Whenever I use add_subdirectory with the QtBase directory, the build always fails with a qt6config.cmake not found. When I point cmake to the folder in the build directory where it will be when the build starts, I get qt6targets.cmake not found. How would I build qt6base alone within my source tree?

    sierdzioS 1 Reply Last reply
    0
    • D daedelus1996

      I have a project that I am using cmake to build. I only need QtBase for my project and want to build only it. I'd rather have the source in my tree. Whenever I use add_subdirectory with the QtBase directory, the build always fails with a qt6config.cmake not found. When I point cmake to the folder in the build directory where it will be when the build starts, I get qt6targets.cmake not found. How would I build qt6base alone within my source tree?

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @daedelus1996 you need to run configure at least once, then, maaaaybe it will work. But I doubt it, Qt code is not written with such use case in mind.

      (Z(:^

      kkoehneK 1 Reply Last reply
      1
      • sierdzioS sierdzio

        @daedelus1996 you need to run configure at least once, then, maaaaybe it will work. But I doubt it, Qt code is not written with such use case in mind.

        kkoehneK Offline
        kkoehneK Offline
        kkoehne
        Moderators
        wrote on last edited by
        #3

        @daedelus1996 , Qt by default expects to be installed before used. I don't think just using add_subdirectory() will work, at least if you want to use any of the CMake convenience like find_package(Qt6 ...) in your code.

        Maybe using something like CMake's ExternalProject, vcpkg or Conan is an alternative for you?

        Director R&D, The Qt Company

        1 Reply Last reply
        0
        • D Offline
          D Offline
          daedelus1996
          wrote on last edited by
          #4

          CMake's ExternalProject_Add works with the bare minimum CMakeLists.txt shown below:

          cmake_minimum_required(VERSION ...)
          project(...)
          include(ExternalProject)
          ExternalProject_Add(QtBase SOURCE_DIR ${CMAKE_SOURCE_DIR}/...)
          
          1 Reply Last reply
          0
          • D daedelus1996 has marked this topic as solved on

          • Login

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