FS#25107 - [cmake] FindQt4.cmake does not work when QT_MIN_VERSION is set

Attached to Project: Arch Linux
Opened by Jekyll Wu (adaptee) - Tuesday, 12 July 2011, 07:03 GMT
Last edited by Andrea Scarpino (BaSh) - Tuesday, 04 October 2011, 22:01 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Andrea Scarpino (BaSh)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

If `set(QT_MIN_VERSION 4.7.0)` and `find_package(KDE4)` are used in the CMakeLists.txt, cmake will report following error message :

-- Found Qt4: /usr/bin/qmake (found suitable version "4.7.3", required is "4.7.0")
CMake Error at /usr/share/apps/cmake/modules/FindQt4.cmake:514 (MESSAGE):
Invalid Qt version string given: "4.7.0", major version 4 is required, e.g.
"4.0.1"
Call Stack (most recent call first):
/usr/share/apps/cmake/modules/FindKDE4Internal.cmake:420 (find_package)
/usr/share/cmake-2.8/Modules/FindKDE4.cmake:95 (FIND_PACKAGE)
CMakeLists.txt:11 (find_package)

I have attached a minimal CMakeLists.txt which can be used to reproduce this problem.

If cmake is downgraded to 2.8.4, or /usr/share/apps/cmake/modules/FindQt4.cmake is deleted, the problem does not exist.

For complete story, see https://bbs.archlinux.org/viewtopic.php?id=122405

Additional info:

cmake-2.8.5-1
kdelibs-4.6.5-1
qt-4.7.3-3


This task depends upon

Closed by  Andrea Scarpino (BaSh)
Tuesday, 04 October 2011, 22:01 GMT
Reason for closing:  No response
Comment by Andrea Scarpino (BaSh) - Tuesday, 12 July 2011, 11:35 GMT
  • Field changed: Summary ([kdelibs] FindQt4.cmake does not work when QT_MIN_VERSION is set → [cmake] FindQt4.cmake does not work when QT_MIN_VERSION is set)
  • Field changed: Category (Packages: Extra → Upstream Bugs)
This is an upstream bug in cmake
http://public.kitware.com/Bug/view.php?id=12332
Comment by Jekyll Wu (adaptee) - Tuesday, 12 July 2011, 12:44 GMT
Thanks for the feedback.

But is it really cmake to be blamed? That upstream report says cmake can't find Qt4, while in this report cmake can actually find Qt4.

If `find_package(KDE4)` is removed from the attached CMakeLists.txt, `find_package(Qt4 REQUIRED)` works well.
If the FindQt4.cmake provided by kdelibs is removed, `find_package(KDE4)` also works well.

Those observations suggest the cause may be the FindQt4.cmake of kdelibs, instead the FindQt4.cmake of cmake. That's why I chose kdelibs when opening this report.

Just my 2 cents.
Comment by Andrea Scarpino (BaSh) - Tuesday, 12 July 2011, 18:06 GMT
anyway did you know you can use find_package(Qt4 4.7.0 REQUIRED) too? This one works.

Loading...