[cmake-developers] Introducing targets in FindPkgConfig

Rolf Eike Beer eike at sf-mail.de
Mon Dec 22 13:38:20 EST 2014


Am Montag, 22. Dezember 2014, 18:55:16 schrieb Daniele E. Domenichelli:
> Hello Eike,
> 
> On 22/12/14 16:39, Rolf Eike Beer wrote:
> > What I would like to get is the following: when a list of libraries and
> > directories is returned by PkgConfig then for every of these libraries the
> > absolute path to the library is determined using find_library() using the
> > given directories as hints.
> > [...]
> > Since this would introduce new behavior people would need to adapt
> > their CMakeLists.txt to this new feature. Therefore I think it would be a
> > good idea to expose this new information not by new variables, but using
> > targets.
> We have a macro to do exactly this and a few other things (actually 2
> macros, that diverged slightly I will make them one again as soon I as I
> have some time), you can find them here:
> 
> 
https://github.com/robotology/yarp/blob/master/conf/MacroStandardFindModule.cmake
> 
https://github.com/robotology/ycm/blob/master/modules/StandardFindModule.cmake

[...]

> > So if I search for OpenSSL using PkgConfig I would get a target
> > PkgConfig::OpenSSL that I can link to, and that has the libraries, compile
> > flags, include dirs and whatnot.
> > 
> > Sadly, I don't quite understand all the macros in FindPkgConfig.cmake. Can
> > you either point me to the right place where I would hook up something
> > like that or try doing it?
> 
> You can start from the macros I linked before for the pkg-config part, and
> then have a look at the CMake modules that create imported targets
> (FindQt4, FindGTK2, FindZLIB, FindGLUT, FindGLEW) for the targets part
> (all the variables you need should be there already).
> Let me know if you do it, I'd like to do it too one day...

The imported targets was not the thing worrying me, although my experience 
with this is a bit limited at the moment.

> About the FindPkgConfig macros documentation, what is that is not clear?

It's not about the documentation of that module, but where I need to hack it 
into the module. The code is quite a bit of indirections, I guess I would need 
to do this _pkg_check_modules_internal at the end of the last foreach?

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141222/048bde01/attachment.sig>


More information about the cmake-developers mailing list