CMake doesn't know where is Qt4 qmake

2019-03-14 11:36发布

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

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

I get:

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!

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.

标签: linux qt cmake
8条回答
唯我独甜
2楼-- · 2019-03-14 12:19

Simplest solution was add a link in the directory that the gem expected to find it. On Ubuntu 14.04 it qmake lives in /usr/bin. Simple solution.

查看更多
三岁会撩人
3楼-- · 2019-03-14 12:19

1) Where is your qtchooser configuration file?

  $: locate qtchooser | grep conf

2) From the list of conf files, probably there is one call "default.conf" This one is a link to one of the others (4.conf or qt4.conf or 5.conf or qt5.conf). Choose the one that makes sense too you, and create a link to it.

Suppose your default file path is

/usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf

Create backup:

  $: cd $(dirname /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf)
  $: cp -av default.conf default.conf_backup

Let's say you target is /usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf

Then:

  $: sudo ln -s /usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf default.conf

3) Is the path to your qmake right?

Check qmake location

  $: locate qmake | grep bin

Is the same one as indicated in your modified qtchooser/default.conf?

  $: cat /usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf

If the answer is YES, then you are done. If the anser is no, then you need to modify the file:

Create backup:

  $: cd $(dirname /usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf)
  $: cp -av qt5.conf qt5.conf_backup

Edit file and change path to your qmake location

  $ sudo vi qt5.conf

Now it should be done.

查看更多
登录 后发表回答