[CMake] PKGCONFIG("dbus-1 >= 1.0.0" ...) should also possible

Claus Klein claus.klein at arcormail.de
Fri Jan 12 04:17:13 EST 2007


On Friday 12 January 2007 08:43, Alexander Neundorf wrote:
> 
> Von: Claus Klein <claus.klein at arcormail.de>
> 
> > Hi,
> > 
> > to be more flexible, here is a patch for UsePkgConfig.cmake
> > 
> > #   PKGCONFIG("dbus-1 >= 1.0.0" ...) is now also possible.
> > 
> > #   Optional, for stage building, the
> > #   PKGCONFIG_OPTIONS and PKG_CONFIG_PATH environment variable are used 
> ...
> 
> Thanks for the patch, but please have a look at the new FindPkgConfig.cmake module, 
> which is much more powerful than the "old" and now obsolete UsePkgConfig.cmake.
> I think FindPkgConfig.cmake should already be able to do what you want.  
> 
> Bye
> Alex
> 
Yes, if found this new Module yesterdy. But for me, a PKGCONFIG_OPTIONS env var should supported too!

The name my be changed, but this prepeares more flexibility and this is needed for cross-compile builds.

from man pkg-config(1):
       --define-variable=VARIABLENAME=VARIABLEVALUE
              This  sets  a  global value for a variable, overriding the value in any .pc files. Most packages define
              the variable "prefix", for example, so you can say:
                $ pkg-config --print-errors --define-variable=prefix=/foo \
                             --variable=prefix glib-2.0
                /foo


If this is not possible, I have always to edit the *.pc files in my stage dir after installation like that:

	sed -i -e "s#/usr#/mystagedir#g" /mystagedir/lib/pkgconfig/*.pc

This has to be done to often, because developers tents to forget to use 
${prefix}, ${libdir} and ${includedir}  in there *.pc.in files.

such a package template should looks like that:
-------------------------------------------------------------------------------
claus at P3linux:~/downloads/cmake-2.4.5/Modules> cat /tools/build_powerpc/dbus-0.60/dbus-1.pc.in
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
system_bus_default_address=@DBUS_SYSTEM_BUS_DEFAULT_ADDRESS@
sysconfdir=@EXPANDED_SYSCONFDIR@

Name: dbus
Description: Free desktop message bus
Version: @VERSION@
Libs: -L${libdir} -ldbus-1
Cflags: -I${includedir}/dbus-1.0 -I${libdir}/dbus-1.0/include

-------------------------------------------------------------------------------

PS.  I find cmake a good tool and I will continue to test it, but my scope is the embedded world, so I need to cross-compile.
        It is very hard to write patches for each new version of a used package, if the developer don't care about that!

Bye

Claus


More information about the CMake mailing list