Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt 6.2.2: find_package fails although the Qt build seems to have succeeded



  • I've downloaded the Qt sources for 6.2.2 and configured with

    configure -opensource -debug-and-release -nomake examples -nomake tests -no-framework -confirm-license -skip qtwebengine -skip qtconnectivity -skip qtwebview -c++std c++17 -platform macx-clang -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_ARCHITECTURES=x86_64 -prefix "/usr/local/Qt-6.2.2"

    then built with

    cmake --build . --parallel

    and installed with

    sudo cmake --install .
    sudo cmake --install . --config Debug

    When I ran cmake on my project, I get the following errors:

    CMake Error at /usr/local/Qt-6.2.2/lib/cmake/Qt6DBus/Qt6DBusDependencies.cmake:71 (find_package):
    Could not find a package configuration file provided by "Qt6DBusTools"
    (requested version 6.2.2) with any of the following names:

    Qt6DBusToolsConfig.cmake
    qt6dbustools-config.cmake
    

    Add the installation prefix of "Qt6DBusTools" to CMAKE_PREFIX_PATH or set
    "Qt6DBusTools_DIR" to a directory containing one of the above files. If
    "Qt6DBusTools" provides a separate development package or SDK, be sure it
    has been installed.
    Call Stack (most recent call first):
    /usr/local/Qt-6.2.2/lib/cmake/Qt6DBus/Qt6DBusConfig.cmake:40 (include)
    /Applications/CMake.app/Contents/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
    /usr/local/Qt-6.2.2/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:14 (find_dependency)
    /usr/local/Qt-6.2.2/lib/cmake/Qt6Gui/Qt6GuiDependencies.cmake:91 (_qt_internal_find_dependencies)
    /usr/local/Qt-6.2.2/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:40 (include)
    CMakeLists.txt:178 (find_package)

    CMake Error at /Applications/CMake.app/Contents/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
    Found package configuration file:

    /usr/local/Qt-6.2.2/lib/cmake/Qt6DBus/Qt6DBusConfig.cmake
    

    but it set Qt6DBus_FOUND to FALSE so package "Qt6DBus" is considered to be
    NOT FOUND.
    Call Stack (most recent call first):
    /usr/local/Qt-6.2.2/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:14 (find_dependency)
    /usr/local/Qt-6.2.2/lib/cmake/Qt6Gui/Qt6GuiDependencies.cmake:91 (_qt_internal_find_dependencies)
    /usr/local/Qt-6.2.2/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:40 (include)
    CMakeLists.txt:178 (find_package)

    CMake Error at CMakeLists.txt:178 (find_package):
    Found package configuration file:

    /usr/local/Qt-6.2.2/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake
    

    but it set Qt6Gui_FOUND to FALSE so package "Qt6Gui" is considered to be
    NOT FOUND.

    This is on macOS 11.6.1 with XCode 13.1 and cmake 3.22.1.
    CMAKE_PREFIX_PATH is set to /usr/local/Qt-6.2.2/bin/
    The same configuration worked with Qt 6.0.1 (the only difference being an obviously different prefix path and the skipping of webenging and webview which wasn't necessaery because they weren't included).

    Any suggestions as to what may cause these problems and potential solutions?


  • Moderators



  • @kshegunov yes: see the second sentence of the last paragraph


  • Lifetime Qt Champion

    Hi,

    It should not point to bin but to "lib/cmake".



  • @SGaist That did the trick. Thanks. Strange that this worked in Qt 6.0.1 though.


Log in to reply