[patch] CMake utility functions

Alexander Neundorf neundorf at kde.org
Tue Nov 27 20:40:18 GMT 2007


Hi Will,

On Tuesday 27 November 2007, Will Stephenson wrote:
> Please review the attached patch, which adds a couple of functions to
> MacroEnsureVersion.cmake to test whether a version number lies in a given
> range.
>
> example: macro_ensure_version_range3( "0.6.5"
> ${NETWORKMANAGER_VERSION} "0.7.0" NM_TOO_OLD NM_TOO_NEW )
>
> The macro_ensure_version_range2 works for versions of the form "x.y".

Some comments:

Please put the documentation for all macros at the top of the file, so it will 
be processed by cmake when it generates documentation (cmake cvs can generate 
docs also for external modules).

Why is the major number only multiplied by 1000 instead of e.g. 10000 ? Then 
it should work until minor number 99.

I don't really like that the range macros indicate success by making both 
return values false. Wouldn't one return value be enough ?
The error message can be "you have version 1.2.3, but a version within 2.0.0 
to 3.0.0 is required".
Another option would be to have only one named argument for the macro and use 
this for returning success, and check ARGN for two additional arguments where 
too_old and too_new are returned.
You could also have an additional argument which would be "OK", "TOO NEW" 
or "TOO OLD".

While you're at it, are the different versions for two and three digit version 
numbers actually required ? It should be possible to detect whether it is a 
two or three digit number and then append a ".0" if it's a two digit number.

Bye
Alex




More information about the kde-core-devel mailing list