Qt conditional version check

Michael Pyne mpyne at kde.org
Sat Jan 9 00:56:19 CET 2010


On Friday 08 January 2010 04:57:51 Will Stephenson wrote:
> What's the canonical way to enable compilation of a subdirectory depending
>  on the version of Qt found?
> 
> I want to be able to only compile the Network Management plasmoid if Qt 4.6
>  is found, but grepping svn yields no good examples, some people are doing
>  manual comparisons of QT_MAJOR_VERSION, QT_MINOR_VERSION etc.

It seems to me after looking at FindQt4.cmake and the cmakecommands manpage 
for if() that the following should be "the best" (assuming you've already run 
find_package for Qt):

set(QT_VERSION "${QT_MAJOR_VERSION}.${QT_MINOR_VERSION}.${QT_PATCH_VERSION}")
if((${QT_VERSION} VERSION_EQUAL x.y.z) OR (${QT_VERSION} VERSION_GREATER 
x.y.z)
  add_subdirectory(widget)
endif()

On the other hand I haven't even bothered to ensure that this is valid syntax 
in CMake, let alone that it actually works.

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20100108/9ffb4870/attachment.sig 


More information about the Kde-buildsystem mailing list