KDEWIN32 library

Brad King brad.king at kitware.com
Mon Feb 13 19:19:09 CET 2006


Alexander Neundorf wrote:
> The output format is not ideal, it should read
> "You are running version: 2.3.3"
> Which leads to the question why it warns at all.
> cmCMakeMinimumRequired.cxx contains the following code:
> 
> float version = float(m_Makefile->GetMajorVersion());
> version += (float(m_Makefile->GetMinorVersion()) * (float).1);
> version += (float(m_Makefile->GetPatchVersion()) * (float).01);
> 
> // gives 2.33 as seen in the output
> 
> float reqVersion = 0;
> int major=0;
> int minor=0;
> int patch=0;
> 
> int res=sscanf(args[1].c_str(), "%d.%d.%d", &major, &minor, &patch);
> if (res==3)
>    reqVersion=float(major)+0.1*float(minor)+0.01*float(patch);
> else if (res==2)
>    reqVersion=float(major)+0.1*float(minor);
> 
> // args[1] is "2.3.3" as can be seen in the output, 
> // so it should also produce 2.33
> 
> if(reqVersion > version)
> {
> 
> // we shouldn't get here, because both should be 2.33, 
> // maybe a rounding problem ?

This is clearly a bad way to test the version, especially because tenths 
cannot be represented exactly by IEEE floating-point values.  We'll fix 
that in CMake.

-Brad


More information about the Kde-buildsystem mailing list