[CMake] Cmake and pkg-config and linking

Brad King brad.king at kitware.com
Tue Aug 15 12:52:02 EDT 2006


Tim Teulings wrote:
> Hello!
> 
> I would like to propose a enhanced version of the PKGCONFIG macro. This
> one sets an aditional variable to return if the library was found. It
> also splits the output of pkg-config into the required variables of
> cmake and already does the right formatting.
> 
> See below an example for how to use it and how to return the result back
> to the relevant cmake functions and variables. Detection code works well
> for a number of libraries (png, cairo, xft, dbus and my own illumination
> library) under unix (Linux). Windows tests (msys) will follow.
> 
> It is also possible to pass complex package strings like "dbus-1 >=
> 0.61" to the PKGCONFIG macro.
> 
> This macro breaks compatibility with the old macro but this was
> necessary because cmake itself needs information split. Everything that
> is not handled within the macro, needs to be handled outside the macro
> anyway. I also have the feeling that defining a "found" variable is in
> line with other functions.
> 
> What is not yet nice is, that I have to pass include and link
> directories before defining my executable and all other options after I
> definition of my executable. This way if illumination would be optional
> I have to use two check blocks.
> 
> It also took me much time to understand when I have to use "-variable"
> and when "${_variable}". Macro passing parameter variables do seem to
> complicate stuff again :-/
> 
> I would be happy to get this included into cmake since I found the old
> version to be more difficult to handle. Please improve it if you like.
> I'll put this under any license you like (Btw., haven't found any
> copyright or license information in at least some macro int he current
> distribution). Have fun!

Please submit feature requests here:

http://www.cmake.org/Bug

You can include your proposed macro in the report.  Discussion with
developers for refinements of the macro can continue there.

-Brad


More information about the CMake mailing list