Eliminating confusion after pkgconfig fails to find packages

Alexander Neundorf neundorf at kde.org
Tue Mar 10 00:32:48 CET 2009


On Tuesday 10 March 2009, David Jarvie wrote:
> Currently, FindXXXX.cmake scripts often use pkgconfig to attempt to find a
> package, followed by other code which may locate it even if pkgconfig
> failed. See for example FindQImageBlitz.cmake. The way these scripts are
> currently coded produces misleading output when they are run, when
> pkgconfig fails to find the package but it is nevertheless found by the
> subsequent code in the script. In the QImageBlitz example, the console
> output is:
>
> -- checking for module 'qimageblitz'
> --   package 'qimageblitz' not found
>
> even if the package is actually found after pkgconfig fails to find it.
> This can lead to significant time wasting trying to work out what has gone
> wrong when in fact nothing is wrong at all.
>
> I propose a new function to replace the call to
> find_package_handle_standard_args() in these scripts. This function would
> always output a 'Found' message, thereby ensuring that the user is not left
> under the impression that a package which actually exists on the system has
> not been found by cmake. The messages in the example would then be:
>
> -- checking for module 'qimageblitz'
> --   package 'qimageblitz' not found
> -- Found QImageBlitz: /opt/kde4.2/include/qimageblitz
>
> The new function is attached. If agreed that this can be committed, I'll
> prepare a patch to modify the relevant FindXXXX.cmake scripts to use it.

In general find_package_handle_standard_args() prints the "Found" message only 
if the message changed. This is what is disabled by your macro, but its name 
suggests that it's related to pkg-config, which it is not directly.

But I think a much better way to do this is to modify FindPkgConfig.cmake so 
that the "package foo not found" message doesn't appear. This message is not 
necessary because we have our own success message anyway at the end. 
The message from FindPkgConfig.cmake could be optionally disabled e.g. via an 
additional argument to pkg_check_modules() or (easier) via a PKG_CONFIG_QUIET 
(or something like this) variable.

It's no (real) problem to add a copy of FindPkgConfig.cmake again to 
kdelibs/cmake/modules/.

Alex


More information about the Kde-buildsystem mailing list