[Interest] Detecting Qt version in cmake

Andreas Pakulat apaku at gmx.de
Thu Sep 5 12:00:56 CEST 2013


Hi,

On Thu, Sep 5, 2013 at 11:30 AM, Joseph W. Joshua <joshua at megvel.me.ke>wrote:

> Hi all,
>
> When using cmake, how can one detect whether the Qt version in use is
> greater that Qt4? In qmake, for example, I can determine whether the Qt
> version is greater than Qt4 by using :
>
> greaterThan(QT_MAJOR_VERSION, 4)xxx
>

If you use find_package(Qt) you can find out wether Qt3 or Qt4 was found
with the variables QT4_INSTALLED and QT3_INSTALLED as documented in the
manual. For Qt5 you'd have to use find_package(Qt5) anyway as thats not
covered by the FindQt.cmake module yet.

In addition, the if-command has operators to compare version numbers
(VERSION_*), see http://cmake.org/cmake/help/v2.8.11/cmake.html#command:if for
more details.

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130905/202142cd/attachment.html>


More information about the Interest mailing list