CMake does not know where Qt4 qmake

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

I am trying to create a qjson library and 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 am not familiar with CMake and Qt configuration, but I am curious how to configure CMake FIND_PACKAGE to search in '/ usr / lib / x86_64-linux-gnu / qt4 / bin / qmake' for qmake. I installed Qt 4.8.5 from the source code, and I have the Qt4 bin folder in a completely different directory.

+19
linux qt cmake
Mar 01 '14 at 11:10
source share
7 answers

I solved my problem.

Searching QT_SELECT with the grep I found that QT_SELECT is associated with the file /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf . From the default file name, I assumed that this is what is considered as QT_SELECT. Other configs provided by qtchooser -l are in the /usr/share/qtchooser/ and /usr/lib/x86_64-linux-gnu/qtchooser .

Such a configuration 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 qtchooser -print-env showing QTTOOLDIR and QTLIBDIR for my Qt.

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

+6
Mar 01 '14 at 15:46
source share

just try "sudo apt-get install qt-sdk", it works for me

+20
Jul 31 '14 at 5:43
source share

In my experience, this problem is most easily solved by putting the folder containing qmake in the PATH environment variable.

+6
Mar 01 '14 at 11:29
source share

Here are the answers

https://askubuntu.com/questions/540746/ubuntu-14-04-qt5-development-libraries/540757#540757

It seems

apt-file search Qt5CoreConfig.cmake was what I was missing. It bothered me:

 qtbase5-dev: /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake 

An installation that seems to lead to CMake Qt5 detection. qmake still reports the same problem when directly called, though ... some remainder of qt4 is still installed, it seems ...

As for the qmake problem, this is fixed:

 sudo apt-get install qt5-default 
+3
May 21 '15 at 12:55
source share

The simplest solution is to add a link to the directory in which the gem should find it. On Ubuntu 14.04, he qmake lives in / usr / bin. A simple solution.

0
Apr 3 '15 at 0:20
source share

In my case, it was qtchooser that was not in the default setting. I realized that cmake just executes qtchooser and looks for the default configuration file name. You can install any configuration file by following these steps:

 qtchooser -install <arbitrary_name> <path_to_qmake> 

In my case, I just provided "default" as an arbitrary name ... it created the default.conf file in the appropriate places, and all is well. I do not think that there is a limit to the number of named qt versions that you have. If you do this as root, it should work for all users.

0
Jan 30 '16 at 13:54 on
source share

On my old RHEL distribution, this did this for me:

 sudo yum install qt-devel.x86_64 

Just qt-base will not work with cmake.

0
Nov 03 '17 at 14:30
source share



All Articles