Help wanted: please check Find-modules which detect the version numbers

Alexander Neundorf neundorf at kde.org
Wed Aug 25 22:07:31 CEST 2010


Hi,

I just updated our copy of FindPackageHandleStandardArgs.cmake to the version 
from cmake master.

This offers a new extended syntax, from the docs:

The second mode is more powerful and also supports version checking:
  FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>]
                                         [VERSION_VAR   <versionvar>
                                         [FAIL_MESSAGE "Custom failure msg"] )

As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND
will be set to TRUE.
Via FAIL_MESSAGE a custom failure message can be specified, if this is not
used, the default message will be displayed.
Following VERSION_VAR the name of the variable can be specified which holds
the version of the package which has been found. If this is done, this version
will be checked against the (potentially) specified required version used
in the find_package() call. The EXACT keyword is also handled. The default
messages include information about the required version and the version
which has been actually found, both if the version is ok or not.

--------------

Our previous version (in KDE 4.5.0) checked automatically whether there is a 
<NAME>_VERSION variable and if there was one, checked the version number 
against the required version. 
This didn't make it into cmake master, but instead this extended version.

So we should check all module which provide a <FOO>_VERSION (or similar) 
variable, and for those which do, change the 
find_package_handle_standard_args() call to the new extended style where we 
can specify the name of the version variable.

I've done that already for FindEigen2.cmake:

-find_package_handle_standard_args(Eigen2 DEFAULT_MSG
-                                  EIGEN2_INCLUDE_DIR EIGEN2_VERSION_OK)
+find_package_handle_standard_args(Eigen2 REQUIRED_VARS EIGEN2_INCLUDE_DIR
+                                         VERSION_VAR EIGEN2_VERSION)


Help with checking the other modules we have is very welcome :-)

Alex


More information about the Kde-buildsystem mailing list