如何修复 Ubuntu 上 CMake Could not find a package configuration file provided by Qt5Core

问题:

尝试使用例如以下命令配置项目时

cmake_configure.sh
cmake .

你看到以下错误消息:

cmake_find_qt_error.txt
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.

解决方案

安装 qtbase5-dev

install_qtbase.sh
sudo apt -y install qtbase5-dev

Check out similar posts by category: C/C++, CMake