Nominate our 2022 Qt Champions!

Qt3D: Using Qt3DExtras Module in Qt C++ with Cmake.

  • Hi,
    I am working on a Qt application using Qt C++ and Qt3D. I am using Cmake to build my project. I want to use Qt3DExtras module but it is showing the error in the line contained in my CMakeLists.txt :find_package(Qt REQUIRED COMPONENTS 3DCore 3DInput 3DExtras) :

    Could not find a package configuration file provided by "Qt53DExtras" with any of the following names: 
    Qt53DExtrasConfig.cmake qt53dextras-config.cmake Add the installation prefix of "Qt53DExtras" to CMAKE_PREFIX_PATH or 
    set "Qt53DExtras_DIR" to a directory containing one of the above files.  If "Qt53DExtras" provides a separate development 
    package or SDK, be sure it has been installed. my_project/CMakeLists.txt:36 (find_package) 

    I am using Qt 5.10.1 on Ubuntu 16.04.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    How did you install Qt ?
    Did you check the content of the lib/cmake folder ins your Qt installation ?

  • I installed Qt using the Online installer provided by the Qt website.
    Yes, the lib/cmake folder contains the Qt3DExtras module.

  • Lifetime Qt Champion

    Then how are you calling cmake to build your project ?

  • Works fine with find_package(Qt53DExtras REQUIRED).... did you try that one? Eeee snap im on win u on ubuntu :c sorry :- (

  • I am following the Qt5 docs for building with CMake:
    All the other modules are loading fine(3DCore,3DRenderer,etc.), but the 3DExtras Module is giving errors.

  • I found the problem: The linux environment variable path was set to the default Qt directory with missing modules. Despite changing the Qt's path from QtCreator, it was still accessing from the old Qt directory. I set the path in CMakeLists.txt by:

    set(Qt5Core_DIR "/usr/local/Qt-5.10.1/lib/cmake/Qt5Core")
    set(Qt5_DIR "/usr/local/Qt-5.10.1/lib/cmake/Qt5")
    set(QT_QMAKE_EXECUTABLE "/usr/local/Qt-5.10.1/bin/qmake")

Log in to reply