What package do I need to build a Qt 5 & CMake application?

90,448

Solution 1

Two things I was missing:

  • After an unsuccessful build, I must remove CMakeCache.txt (or simply clear the build directory); otherwise cmake will report the same error even if the needed package has been installed.

  • The packages which provide the *.cmake configuration files have names of the form qt*5-dev, e.g. for the error in my question, qtcore5-dev.

Solution 2

I just stumbled upon this question while trying to compile KeePassX 2.0.

What helped me was to use apt-file to search for the missing packages:

For example running this:

apt-file search Qt5CoreConfig.cmake

Returned the following packages:

qtbase5-dev: /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake

qtbase5-gles-dev: /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake

These packages can then be installed with apt or apt-get, e.g.:

sudo apt install qtbase5-dev

Solution 3

If you tried the above solutions and it didn't work, also try apt-get install libqt5opengl5-dev, that worked for me.

Share:
90,448

Related videos on Youtube

tdotcspot
Author by

tdotcspot

Updated on September 18, 2022

Comments

  • tdotcspot
    tdotcspot over 1 year

    I'm trying to build sdrangelove, which wants Qt 5 and uses CMake for its build system, on Ubuntu 13.10. What package do I need to install to give it the file it's asking for here?

    There are a lot of *qt5* packages, and I've tried installing the promising looking ones to no effect. All the discussions I've found either have things working fine or are talking about writing CMake build rules rather than executing them. I don't have a lot of experience with the organization of Debian/Ubuntu packaging.

    CMake Error at CMakeLists.txt:14 (find_package):
      By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "Qt5Core", but
      CMake did not find one.
    
      Could not find a package configuration file provided by "Qt5Core"
      (requested version 5.0) with any of the following names:
    
        Qt5CoreConfig.cmake
        qt5core-config.cmake
    
      Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
      "Qt5Core_DIR" to a directory containing one of the above files.  If
      "Qt5Core" provides a separate development package or SDK, be sure it has
      been installed.
    
  • Francisco V.
    Francisco V. over 8 years
    Another option is to use apt-file to search the missing package: apt-file search Qt5CoreConfig.cmake qtbase5-dev: /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake qtbase5-gles-dev: /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake
  • tdotcspot
    tdotcspot over 8 years
    @FranciscoV. What you have written deserves to be in an answer. It'll be easier to read the example that way, too.
  • parasrish
    parasrish almost 6 years
    quick ref for apt-file (wiki.ubuntu.com/AptFile). works.
  • funder7
    funder7 about 2 years
    first time that I see this tool. It's very... very, very useful! :-)
  • user643722
    user643722 about 2 years
    Thanks! I was totally missing these files by grepping for strings including "qt5".