Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-115437

Setting Qt6_DIR is not enough to find Qt packages

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 6.4.0, 6.5.2
    • Build System: CMake
    • None

    Description

      Configuring the following project

      cmake_minimum_required(VERSION 3.22)
      project(app)
      find_package(Qt6 COMPONENTS Widgets)
      

      with

      cmake .. -DQt6_DIR=/Users/alex/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6
      

      fails with

      CMake Warning at /usr/local/Cellar/cmake/3.26.4/share/cmake/Modules/CMakeFindDependencyMacro.cmake:76 (find_package):
        By not providing "FindQt6CoreTools.cmake" in CMAKE_MODULE_PATH this project
        has asked CMake to find a package configuration file provided by
        "Qt6CoreTools", but CMake did not find one.
      
        Could not find a package configuration file provided by "Qt6CoreTools"
        (requested version 6.5.2) with any of the following names:
      
          Qt6CoreToolsConfig.cmake
          qt6coretools-config.cmake
      
        Add the installation prefix of "Qt6CoreTools" to CMAKE_PREFIX_PATH or set
        "Qt6CoreTools_DIR" to a directory containing one of the above files.  If
        "Qt6CoreTools" provides a separate development package or SDK, be sure it
        has been installed.
      Call Stack (most recent call first):
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6GuiTools/Qt6GuiToolsDependencies.cmake:9 (find_dependency)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6GuiTools/Qt6GuiToolsConfig.cmake:33 (include)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:65 (find_package)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiDependencies.cmake:34 (_qt_internal_find_tool_dependencies)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:40 (include)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package)
        CMakeLists.txt:4 (find_package)
      
      
      CMake Error at /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6/QtPublicTargetHelpers.cmake:257 (get_property):
        get_property could not find TARGET Qt6::qvkgen.  Perhaps it has not yet
        been created.
      Call Stack (most recent call first):
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6GuiTools/Qt6GuiToolsConfig.cmake:56 (__qt_internal_promote_target_to_global)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:65 (find_package)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiDependencies.cmake:34 (_qt_internal_find_tool_dependencies)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:40 (include)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package)
        CMakeLists.txt:4 (find_package)
      
      
      CMake Warning at /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:65 (find_package):
        Found package configuration file:
      
          /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6GuiTools/Qt6GuiToolsConfig.cmake
      
        but it set Qt6GuiTools_FOUND to FALSE so package "Qt6GuiTools" is
        considered to be NOT FOUND.  Reason given by package:
      
        Qt6GuiTools could not be found because dependency Qt6CoreTools could not be
        found.
      
      Call Stack (most recent call first):
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiDependencies.cmake:34 (_qt_internal_find_tool_dependencies)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:40 (include)
        /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package)
        CMakeLists.txt:4 (find_package)
      
      
      CMake Warning at /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package):
        Found package configuration file:
      
          /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake
      
        but it set Qt6Gui_FOUND to FALSE so package "Qt6Gui" is considered to be
        NOT FOUND.  Reason given by package:
      
        Qt6Gui could not be found because dependency Qt6GuiTools could not be
        found.
      
        Configuring with --debug-find-pkg=Qt6GuiTools might reveal details why the
        package was not found.
      
        Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
        of the path variables that find_package uses to try and find the package.
      
      Call Stack (most recent call first):
        CMakeLists.txt:4 (find_package)
      
      
      CMake Warning at CMakeLists.txt:4 (find_package):
        Found package configuration file:
      
          /Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6/Qt6Config.cmake
      
        but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
        FOUND.  Reason given by package:
      
        Failed to find required Qt component "Gui".
      
        Expected Config file at
        "/Volumes/T3/Dev/qt/official/6.5.2/macos/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake"
        exists
      
      
      
        Configuring with --debug-find-pkg=Qt6Gui might reveal details why the
        package was not found.
      
        Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
        of the path variables that find_package uses to try and find the package.
      

      This should have worked due to https://codereview.qt-project.org/c/qt/qtbase/+/421441
      but apparently it either regressed or never worked.
      It does work if looking just for Core.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              alexandru.croitor Alexandru Croitor
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes