Search code examples
c++ubuntuqt4cmake

Qt4 won't compile with CMake


I'm now under Linux with KDevelop for C++ and I want to compile a Qt4 application, but when I do, it gives me the following error :

I compile with:

cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Debug /home/myname/projects/First Qt projet/

Those are the errors:

-- Configuring incomplete, errors occurred!
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (MESSAGE):
  Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE
  QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR
  QT_QTCORE_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:288 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindQt4.cmake:1200 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:3 (find_package)

What should I do ?


Solution

  • sudo apt-get install libqt4-core libqt4-dev libqt4-gui qt4-dev-tools
    

    This should install qt4 for you in: /usr/lib64/qt... from there cmake should be able to pick up the location of qt for you.

    You can also use that Ubuntu package manager thingy if command line isn't your style.