Eliminating confusion after pkgconfig fails to find packages
David Jarvie
djarvie at kde.org
Tue Mar 10 02:04:17 CET 2009
On Mon 9 March 2009 23:32:48 Alexander Neundorf wrote:
> 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/.
OK, here's a patch to FindPkgConfig.cmake (from cmake 2.6.2) to provide a
QUIET option for pkg_check_modules(). For example,
pkg_check_modules(PC_QIMAGEBLITZ QUIET qimageblitz)
OK to commit to kdelibs/cmake/modules? If so, I'll do a patch to convert the
relevant FindXXXX.cmake files.
--
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindPkgConfig.diff
Type: text/x-diff
Size: 2439 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20090310/3a4b768c/attachment.bin
More information about the Kde-buildsystem
mailing list