MantisBT - CMake
View Issue Details
0012332CMakeCMakepublic2011-07-12 04:572016-06-10 14:31
spineless 
Kitware Robot 
normalmajoralways
closedmoved 
Qt 4.7.2 for Desktop MingwWinXpservice pack 3
CMake-2-8 
 
0012332: CMake fails to find Qt 4
CMake fails to find Qt 4 installation. CMake should be able to find Qt without any user configuration, and this bug severely limits its usability as the most universal make program available.

While importing a project into Qt using its SVN import wizard. Wizard tries to use cmake to import project, but fails with the following message:

juffed version: 0.8.2
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (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):
C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1162 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:205 (FIND_PACKAGE)


Also, The error message is not clear enough for a user just trying out cmake for the first time to be able to correct the issue themselves.
Install latest Qt SDK
Install CMake

In Qt creator select:
Create new project...
Project from version control -> subversion checkout
Repository: http://juffed.svn.sourceforge.net/svnroot/juffed/0.8 [^] (for example)
Next >
Run cmake
find_package, FindQt4.cmake, qt, QT_QMAKE_EXECUTABLE
Issue History
2011-07-12 04:57spinelessNew Issue
2011-07-12 04:59spinelessTag Attached: find_package
2011-07-12 04:59spinelessTag Attached: qt
2011-07-12 04:59spinelessTag Attached: FindQt4.cmake
2011-07-12 04:59spinelessTag Attached: QT_QMAKE_EXECUTABLE
2011-07-12 12:23Clinton StimpsonNote Added: 0027028
2011-07-12 12:28Clinton StimpsonNote Added: 0027029
2011-07-13 04:35spinelessNote Added: 0027034
2011-07-13 05:26spinelessNote Edited: 0027034bug_revision_view_page.php?bugnote_id=27034#r378
2011-07-13 17:54Aurelien ValleeNote Added: 0027035
2012-08-11 11:38David ColeStatusnew => backlog
2012-08-11 11:38David ColeNote Added: 0030276
2016-06-10 14:28Kitware RobotNote Added: 0041861
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0027028)
Clinton Stimpson   
2011-07-12 12:23   
Do you have an idea on how CMake would automatically find it?

What do you think of asking the Qt Creator developers to pass that information down to CMake when creating the project?
One can have multiple Qt installations with Qt Creator, and Qt Creator will let you choose which one(s) to use when creating a non-CMake based project. I don't think CMake would really know which of multiple ones to use. Even if there was only one Qt, the Qt Creator installer doesn't put anything in the registry for CMake to look up.
(0027029)
Clinton Stimpson   
2011-07-12 12:28   
QtCreator bug 2346 seems related.
(0027034)
spineless   
2011-07-13 04:35   
(edited on: 2011-07-13 05:26)
If you think it's impossible to find Qt installation directories automatically, how about printing out a line in the error message to tell the user how to set up cmake to find and use the correct version of Qt?

What's the file "FindQt4.cmake" for, it not for finding Qt4 then?

(0027035)
Aurelien Vallee   
2011-07-13 17:54   
"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)"

This message is reported by FIND_PACKAGE_HANDLE_STANDARD_ARGS in FindQt4.cmake:1162

This implies that either of these variables are not set: QT_QMAKE_EXECUTABLE, QT_MOC_EXECUTABLE, QT_RCC_EXECUTABLE, QT_INCLUDE_DIR, QT_LIBRARY_DIR.

Looking at the script, it seems to try to locate Qt using the qmake executable to retrieve the Qt install path (which is a fairly sane and standard practice).

The possible solutions for your problem are:
1. Add the path to the directory containing the qmake executable to your PATH environment variable (i.e. export PATH=/path/to/qmake/dir/:PATH under linux)
2. Set the cmake variable QT_QMAKE_EXECUTABLE to the full path of the qmake executable (i.e. cmake /path/to/CMakeLists.txt -DQT_QMAKE_EXECUTABLE=/path/to/qmake/executable/dir/)
3. Set the QT_QMAKE_EXECUTABLE in your CMakeCache.txt or using ccmake/cmakegui
(0030276)
David Cole   
2012-08-11 11:38   
Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041861)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.