[CMake] What is the preferred method of handling inter-library dependencies?

Brad King brad.king at kitware.com
Thu Jul 13 17:02:55 EDT 2006


William A. Hoffman wrote:
> At 04:41 PM 7/13/2006, Alan W. Irwin wrote:
>> How do I get access to the actual link flags used for the link command
>> generated by cmake (which presumably includes all the appropriate -L and -l
>> flags to access lib[xyz] and libexternal[12] as well as platform-dependent
>> link flags).  I need those actual link flags to configure pkg-config files
>> that describe how external applications should link to libx, liby, and libz.
> 
> That is a harder question, which is why I ignored it... :) 
> 
> The information is not to hard to get at from c++, and some if it
> is in the cache.  It may require some sort of new cmake built in command
> to create pkg-config files.  Is anyone doing something like this?

The set of link directories and libraries needed to use a package from
its installation is not necessarily the same as that needed to build it
in the first place.  The same goes for include directories.

This information is computed by a few CMake projects in order to provide
packaging files, though not pkg-config specifically.  Basically you have
to keep track of what include directories, link directories, and
libraries come from 3rd party (outside your project) tools and list them
separately.  Then add to the list the locations to which you install
your project.

VTK is such a project, though it is more complicated because it is a
non-trivial project:

http://www.vtk.org/cgi-bin/viewcvs.cgi/vtkGenerateVTKConfig.cmake?view=markup
http://www.vtk.org/cgi-bin/viewcvs.cgi/VTKConfig.cmake.in?view=markup

-Brad


More information about the CMake mailing list