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

Axel Roebel Axel.Roebel at ircam.fr
Fri Jan 12 05:39:31 EST 2007


On Friday 12 January 2007 10:17, Claus Klein wrote:
> 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!

For me it is rather difficult to understand what the --define-variable thing 
may be good for. Isn't 

$> pkg-config --print-errors --define-variable=prefix=/foo  --variable=prefix glib-2.0

more or less equivalent to

$> if pkg-config --exists glib-2.0 ; then  echo /foo; fi

???

Anyway:

You may just add a local directory of cmake modules into your project
and keep your own versions of the .cmake files there if the standard 
ones don't serve what you need. 


> Bye
>
> Claus
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

-- 
Axel Roebel
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540


More information about the CMake mailing list