[CMake] Cmake and pkg-config and linking

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Jul 29 14:29:15 EDT 2006


On 2006-07-29 16:18-0000 rael at edge.ping.de wrote:

> My pkg-config 0.15 and also the current version have aditional access options 
> which already split compiler flags and linker flags into directory including 
> parts and library linking and other parts. Which seems to be exactly the 
> information that has to be injected into cmake. Why were such options not 
> used? 
> --libs                                         output all linker flags
> --libs-only-l                                  output -l flags
> --libs-only-other                              output other libs (e.g.
>                                               -pthread)
> --libs-only-L                                  output -L flags
> --cflags                                       output all pre-processor and
>                                               compiler flags
> --cflags-only-I                                output -I flags
> --cflags-only-other                            output cflags not covered by
>                                               the cflags-only-I option
> Property support for pkg-config IMHO is high priority because more and more 
> unix software makes use of it - and it is realy simple to use.

Look for PKGCONFIG in http://www.cmake.org/HTML/Documentation.html.  There
you will find it already gives you includedir, libdir, linkflags, and
cflags.  If you look at the implementation (Modules/UsePkgConfig.cmake), the
last two arguments return the equivalent of --libs and --cflags, and it
would be extraordinarily easy (just a few lines of extra code) to define an
enhanced version of UsePkgConfig.cmake for your own use to deliver the
remaining flags that you ask for above.  I agree those additonal flags are
important so I hope this enhancement also quickly gets into the official
UsePkgConfig.cmake as well.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list