c++ - 尝试使用cmake编译

标签 c++ qt

我正在尝试编译一个依赖于 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 找到它。

最佳答案

错误是说这段代码需要Qt 4.x那么你在徘徊什么呢?这是由于 FIND_PACKAGE(Qt4 REQUIRED) 行造成的,尽管 Cmake 版本应该支持 Qt5,但可能是您的 CmakeList 没有为此正确编写。 关注 this更正您的 CmakeList 的文档。

关于c++ - 尝试使用cmake编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20085321/

相关文章:

qt - 如何设置 QML TableViewStyle 以显示中间椭圆 (ElideMiddle)

qt - 按 QML ListView 中的角色对 QAbstractListModel 派生模型进行排序

c++ - Qt 静态构建 - 不可能的大小

c++ - 使用 Boost 无法解析的外部符号

c++ - Debian 8.1 Jessie 中的 g++ errno_t 和 fopen_s 错误

c++ - opengl linux undefined reference to basic functions

C++ 运行时调试(诊断策略和构造)

c++ - 解析字符串以获取 int

javascript - Promisify QT 回调到 AngularJS Promise

C++ 将字符转换为字节数组