Automatic recording of required packages...

Christophe Giboudeaux cgiboudeaux at
Mon Nov 1 15:23:21 CET 2010


Le 31/10/2010 13:40, Alexander Neundorf a écrit :
> So I enhanced this a bit more, which resulted in FindPackageLog.txt-required.
> Maybe you see the problem, basically all packages are listed as "OPTIONAL", 
> while I guess not all of them are optional.
> The problem is our macro macro_log_feature(), or more to the point 
> the "REQUIRED" argument for macro_log_feature().
> This is how we use that:
> find_package(ZLIB)
> macro_log_feature(ZLIB_FOUND
>                   "ZLib" 
>                   "The Zlib compression library"
>                   "" 
>                   TRUE 
>                   "" 
>            "Required by the core KDE libraries and some critical kioslaves.")
> Here this argument is set to TRUE.
> So also if ZLIB has not been found, cmake processing continues, and if at the 
> end some packages which were marked this way as "REQUIRED" have not been 
> found, an according error message is printed and cmake exits with an error.
> This has two problem: cmake processing continues, while some variables which 
> are expected to be set (e.g. ZLIB_INCLUDE_DIR) are used in CMakeLists.txt 
> expecting that they are set to a valid location since ZLIB is REQUIRED, but 
> they are not. Same for library or other variables. This can cause other cmake 
> errors.
> The second problem is what you see in FindPackageLog.txt-required . Basically 
> all our packages are listed as OPTIONAL there.
> I never liked this "REQUIRED" argument for macro_log_package(), and now I like 
> it even less.
> We tried to outsmart/work around cmake behaviour instead of going for a proper 
> solution.
> So, where am I going with this...
> I think I'd like to propose that macro_log_feature() ignores the REQUIRED 
> keyword (we can't simply remove it due to compatibility reasons) and that we 
> use REQUIRED in the find_package() calls instead.
> Pros: 
> - correct listing of all found and not-found packages by FeatureSummary.cmake
> - cmake stops processing when something is REQUIRED has not been found
> Cons: no summary of multiple missing required packages at the end of the cmake 
> run, only the last missing REQUIRED dependency will be printed.
> Opinions ?

That means cmake will stop running if it's unable to find a required
package and repeat that for *every* missing required dependency.

So instead of having a nice summary with the missing required
dependencies, we'd just see cmake hang. That surely is a regression and
I still don't get why you don't like the macro_log_feature behaviour.

So *my* opinion: an external txt file with missing deps might be
interesting, but if that means using the REQUIRED keyword again in the
find_package() commands, then the KDE build system can survive without it.

Your 'pros' is already what we have actually: a nice summary which
reports what was found, not found and additionaly indicates what is
optional and what is required.


More information about the Kde-buildsystem mailing list