How to fix CMake "Could not find a package configuration file provided by "Qt5Core" on Ubuntu?
Problem:
When trying to configure your project using e.g.
cmake .
you see the following error messages:
CMake Warning at CMakeLists.txt:120 (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:
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.
Solution
Install qtbase5-dev
:
sudo apt -y install qtbase5-dev