正在尝试使用cmake进行编译

Attempting to compile with cmake

本文关键字:cmake 编译      更新时间:2023-10-16

我正试图编译一个在Cmake和Qt中具有依赖关系的程序(在Mountain Lion上)。代码

cmake build

返回

CMake Error at /Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/FindQt4.cmake:1386 (message):
 Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
  CMakeLists.txt:195 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!

当前的Qt版本是5.1.1,我已经在~/bin/中安装了它,我不知道如何让Cmake找到它。

错误是说this code requires Qt 4.x,那么你在徘徊什么?这是由于行FIND_PACKAGE(Qt4 REQUIRED),尽管Cmake版本应该支持Qt5,但可能是您的CmakeList不适合为此编写。请按照本文档更正您的CmakeList。