[CMake] question on pkg_check_modules()

Philip Lowman philip at yhbt.com
Fri May 9 19:04:56 EDT 2008


On Fri, May 9, 2008 at 4:12 PM, Alexander Neundorf <a.neundorf-work at gmx.net>
wrote:

> On Friday 09 May 2008, Philip Lowman wrote:
> > Should the pkg_check_modules() included with CMake 2.6.0 in
> > FindPkgConfig.cmake return full path declarations for <XPREFIX>_LIBRARIES
> > and <XPREFIX>_STATIC_LIBRARIES instead of just NameA;NameB;NameC ?
> >
> > This would make an extremely useful feature in my book in trying to port
> > stuff to CMake 2.6.0.  Anyone else agree?
>
> Yes, I do.


I implemented it.  I could use feedback and testing.  It seems to work fine
for me and plays very nicely with CMake's new file-extension based
find_library support and full path target_link_libraries support.  Here are
the changes:

1.  <XPREFIX>_LIBRARIES is now <XPREFIX>_LIBRARIES_NOPATHS.

2.  Full paths for <XPREFIX>_LIBRARIES_NOPATHS are calculated.  For each
library in the linking list, find_library() is used to create an advanced
cache variable to attempt to find said library.

3.  First <XPREFIX>_LIBRARY_DIRS is searched with NO_DEFAULT_PATH, then the
CMake system path (/lib, /usr/lib, whatever).  Variables like
CMAKE_LIBRARY_PATH are ignored right now (rationale is to prevent picking
stuff not dictated by the pkgconfig path).

4.  If a full path to a library is found, it gets placed in
<XPREFIX>_LIBRARIES

5.  If a full path to a library is _not_ found a warning is issued and the
plain library name is substituted into <XPREFIX>_LIBRARIES

6.  Ditto for <XPREFIX>_STATIC_LIBRARIES

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080509/d28793f1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindPkgConfig.cmake
Type: application/octet-stream
Size: 17614 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080509/d28793f1/attachment.obj>


More information about the CMake mailing list