Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

CMake error on Qt5Core

📅 2015-Oct-13 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cmake, qt ⬩ 📚 Archive


I tried to build source code that uses Qt5 using CMake. It quit with this error:

CMake Error at CMakeLists.txt:20 (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" with any
  of the following names:


  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.


I checked for Qt5 packages and they seemed to be installed. There has been a naming change between Qt4 and Qt5 packages in Ubuntu and that threw me off.

What was needed is the package qtbase5-dev. Once I installed it, this error was solved:

$ sudo apt install qtbase5-dev

Tried with: Ubuntu 14.04

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧