【问题标题】:CMake can't find Qt4 but then finds Qt4CMake 找不到 Qt4 但随后找到 Qt4
【发布时间】:2017-09-08 18:02:03
【问题描述】:

我的 CMakeLists.txt 中有以下内容

find_package(Qt4 4.8.6 REQUIRED COMPONENTS Core)

target_link_libraries(debug Qt4::Core)

我收到以下错误

Could NOT find Qt4 (missing: QT_CORE_INCLUDE_DIR QT_CORE_LIBRARY) (found
suitable version "4.8.6", minimum required is "4.8.6")

我跑了dpkg -l | grep qt,我有libqt4-dev,which qmake返回/usr/bin/qmake

有什么想法吗?如果有帮助,我在 Ubuntu 上。

【问题讨论】:

    标签: qt ubuntu cmake


    【解决方案1】:

    Qt4“核心”组件的正确名称是QtCore。参见例如this question 作为使用示例。


    错误信息表示 CMake 部分找到了 QT4:它找到了基本库和包含目录,但它无法找到您询问的有关“核心”组件的内容。注意缺少变量名称中的CORE 子字符串。

    【讨论】:

      猜你喜欢
      • 2012-04-13
      • 1970-01-01
      • 2013-02-25
      • 1970-01-01
      • 2014-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多