CMake不知道Qt4 qmake在哪里 [英] CMake doesn't know where is Qt4 qmake

查看:971
本文介绍了CMake不知道Qt4 qmake在哪里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Debian操作系统,我试图指向cmake哪里是我的Qt4。

I am using Debian OS and I'm trying to point to cmake where is my Qt4.

我尝试构建qjson库及其CMakeLists.txt:
http://pastebin.com/fKNp0Qgy

I try to build qjson library and with its CMakeLists.txt: http://pastebin.com/fKNp0Qgy

我得到:

Qt5 not found, searching for Qt4
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
CMake Error at /usr/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:55 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!

我不熟悉CMake和Qt配置,但我很好奇什么设置力CMake FIND_PACKAGE为qmake查看'/ usr / lib / x86_64-linux-gnu / qt4 / bin / qmake'。
我从源代码安装了Qt 4.8.5,我的Qt4 bin文件夹位于完全不同的目录中。

I'm not familiar with CMake and Qt config, but I'm curious what setting force CMake FIND_PACKAGE to look into '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake' for qmake. I have installed Qt 4.8.5 from source and I have Qt4 bin folder in completely different directory.

推荐答案

解决我的问题。

使用 grep 命令寻找QT_SELECT我发现QT_SELECT与 /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf 文件。从默认文件名,我认为它是被看作是QT_SELECT。其他配置 qtchooser -l <​​/ code>在 / usr / share / qtchooser / usr / lib / x86_64-linux-gnu / qtchooser 目录。

Looking for QT_SELECT with grep command I found that QT_SELECT is related to /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf file. From the "default" file name I assumed that it is what is seen as QT_SELECT. Other configs presented with qtchooser -l are in /usr/share/qtchooser/ and /usr/lib/x86_64-linux-gnu/qtchooser directories.

这样的配置文件有两行路径。我只是改变了这些行,首先指向我的Qt bin目录,然后指向我的Qt lib目录。然后我可以看到 qtchooser -print-env 显示 QTTOOLDIR QTLIBDIR 到我的Qt。

Such a config file has two lines with paths. I just changed these lines, first pointing to my Qt bin directory and second pointing to my Qt lib directory. Then I could see that qtchooser -print-env shows QTTOOLDIR and QTLIBDIR to my Qt.

然后我可以很容易地构建qjson库与CMake,Qt4被正确找到。

Then I could easily build qjson library with CMake, Qt4 was found correctly.

这篇关于CMake不知道Qt4 qmake在哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆