Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have QT5 installed on 12.10 I believe because it is a dependency for the Ubuntu SDK and the Ubuntu touch tools which I have been using. I have QT4 installed as well, infact I had it installed first.

I now need to compile some code for work that uses the QT4 libraries but cmake is complaining

-- Found unsuitable Qt version "5.0.2" from /usr/bin/qmake

Even though I am using

# find and set up qt
find_package (Qt4)

In the CMAKE file

So I need to find a way to make CMake find Qt4, which I tried and couldn't figure out. Also, its not my code so I don't want to have a custom Cmake file just for me.

Because I am a bit short of time I thought that I would just remove QT5 for now and reinstall it later. But when I try to remove it I get the following. I don't want it to remove all the other packages it says it will (bottom).

Any advice on either compiling with QT4 or getting rid of QT5 would be appreciated.

The following packages will be REMOVED
account-plugin-aim account-plugin-facebook account-plugin-flickr account-plugin-google account-plugin-identica account-plugin-jabber account-plugin-salut account-plugin-twitter account-plugin-windows-live  account-plugin-yahoo appmenu-qt checkbox-qt cordova-ubuntu-2.8 cordova-ubuntu-2.8-dev cordova-ubuntu-2.8-examples empathy everpad gnome-control-center-signon gwibber-service-facebook gwibber-service-identica  gwibber-service-twitter katepart kde-runtime kdelibs-bin kdelibs5-plugins kdoctools kile konsole kubuntu-debug-installer libaccount-plugin-1.0-0 libaccounts-qt1 libattica0.4 libdbusmenu-qt2 libkactivities-bin  libkactivities6 libkatepartinterfaces4 libkcmutils4 libkde3support4 libkdeclarative5 libkdecore5 libkdesu5 libkdeui5 libkdewebkit5 libkdnssd4 libkemoticons4 libkfile4 libkhtml5 libkidletime4 libkio5  libkjsapi4 libkjsembed4 libkmediaplayer4 libknewstuff3-4 libknotifyconfig4 libkntlm4 libkonq-common libkonq5abi1 libkparts4 ibkprintutils4 libkpty4 libkrosscore4 libktexteditor4 libkxmlrpcclient4 libnepomuk4 libnepomukcore4abi1 libnepomukquery4a libnepomuksync4 libnepomukutils4 libntrack-qt4-1 libokularcore1abi1 libphonon4 libplasma3 libpolkit-qt-1-1 libpoppler-qt4-4 libpyside1.1 libqapt-runtime libqapt1 libqca2  libqgis1.7.5 libqgsttools-p1 libqimageblitz4 libqjson0 libqt4-core libqt4-dbus libqt4-declarative libqt4-declarative-gestures libqt4-declarative-particles libqt4-designer libqt4-dev libqt4-dev-bin libqt4-gui  libqt4-help libqt4-network libqt4-opengl libqt4-opengl-dev libqt4-qt3support libqt4-script libqt4-scripttools libqt4-sql libqt4-sql-sqlite libqt4-svg libqt4-test libqt4-xml libqt4-xmlpatterns libqt53d5  libqt5clucene5 libqt5concurrent5 libqt5contacts5 libqt5core5 libqt5dbus5 libqt5declarative5 libqt5designer5 libqt5designercomponents5 libqt5feedback5 libqt5gui5 libqt5help5 libqt5location5  libqt5location5-plugins libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediaquick-p5 libqt5multimediawidgets5 ibqt5network5 libqt5opengl5 libqt5opengl5-dev libqt5organizer5 libqt5printsupport5  libqt5qml-graphicaleffects libqt5qml5 libqt5quick5 libqt5quickparticles5 libqt5quicktest5 libqt5script5 libqt5scripttools5 libqt5sensors5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5svg5-dev  libqt5systeminfo5 libqt5test5 libqt5v8-5 libqt5v8-5-dev libqt5versit5 libqt5webkit5 libqt5webkit5-dev libqt5webkit5-qmlwebkitplugin libqt5widgets5 libqt5xml5 libqt5xmlpatterns5 libqt5xmlpatterns5-dev  libqtassistantclient4 libqtcore4 libqtgui4 libqtwebkit-dev libqtwebkit4 libqwt5-qt4 libsignon-extension1 libsignon-glib1 libsignon-plugins-common1 libsignon-qt1 libsolid4 libsoprano4 libthreadweaver4  libunity-action-qt1 mcp-account-manager-uoa nautilus-sendto-empathy nepomuk-core okular phonon phonon-backend-gstreamer plasma-scriptengine-javascript pymi pyqt4-dev-tools python-pyside.qtcore  python-pyside.qtgui python-pyside.qtnetwork python-pyside.qtwebkit python-qgis python-qt4 python-qt4-dbus qapt-batch qdbus qgis qgis-plugin-grass qgis-providers qmlscene qt-at-spi qt3d5-dev qt4-demos  qt4-designer qt4-linguist-tools qt5-default qtbase5-dev qtcreator qtcreator-plugin-ubuntu qtcreator-plugin-ubuntu-cordova qtdeclarative5-cordova-2.8-plugin qtdeclarative5-dev qtdeclarative5-dev-toolsqtdeclarative5-folder listmodel-plugin qtdeclarative5-localstorage-pluginqtdeclarative5-particles-plugin qtdeclarative5-qtaudioengine-plugin qtdeclarative5-qtfeedback-plugin qtdeclarative5-qtmultimedia-plugin  qtdeclarative5-qtquick2-plugin qtdeclarative5-qtsensors-plugin qtdeclarative5-ubuntu-ui-toolkit-plugin qtdeclarative5-unity-action-plugin qtdeclarative5-window-plugin qtdeclarative5-xmllistmodel-plugin qtlocation5-dev qtmultimedia5-dev qtscript5-dev qtsensors5-dev qttools5-dev qttools5-dev-tools shotwell signon-keyring-extension signon-plugin-oauth2 signon-plugin-password signon-ui signond sni-qt  soprano-daemon spotify-client ubuntu-desktop ubuntu-sdk ubuntu-sso-client-qt ubuntu-ui-toolkit-examples ubuntuone-control-panel-qt unity-scope-gdocs virtualbox-4.2
share|improve this question
up vote 4 down vote accepted

The solution was to add the following to my CMakeLists.txt

set(QT_QMAKE_EXECUTABLE /usr/bin/qmake-qt4)

Then it compiled fine

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.