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.
On my old RHEL distro, this did it for me:
Just the qt-base one wouldn't work with cmake.
just try "sudo apt-get install qt-sdk" it works for me
Here is the answers
https://askubuntu.com/questions/540746/ubuntu-14-04-qt5-development-libraries/540757#540757
Seems
apt-file search Qt5CoreConfig.cmake
was what I was missing. This got me:Installing that seems to lead to CMake finding Qt5.
qmake
still reports the same problem when directly called though...some remnant from qt4 still installed it seems...As for the
qmake
problem, this is fixed by:In my experience, this problem is most easily solved by putting the folder containing qmake in your PATH environment variable.
In my case it was just that qtchooser was missing the "default" configuration. I figured cmake is just executing qtchooser and looking for a "default" configuration file name. You can install any configuration file by doing the following:
In my case I simply provided "default" as the arbitrary name... this created the default.conf file in the appropriate locations and all is well. I don't think there is a limit to how many named versions of qt you have. If you do this as root it should work for all users.
I solved my problem.
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 withqtchooser -l
are in/usr/share/qtchooser/
and/usr/lib/x86_64-linux-gnu/qtchooser
directories.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
showsQTTOOLDIR
andQTLIBDIR
to my Qt.Then I could easily build qjson library with CMake, Qt4 was found correctly.