[CMake] Find scripts and dependent libraries

Alexander Neundorf a.neundorf-work at gmx.net
Tue Apr 21 15:43:25 EDT 2009


On Tuesday 21 April 2009, Gregory Peele ARA/CFD wrote:
> I have a question about the expected behavior of Find scripts when a found
> library or program has transitive linking dependencies on other shared
> libraries that are not available on the system library path, but visible to
> Find scripts because of the CMake search paths.  I'm using GCC 4.2 on
> Linux-i686 and Linux-x86_64, not sure which other systems have similar
> linking behavior.
>
> For example, if I call FIND_PACKAGE ("DevIL"), it will pick up my custom
> IL, ILU, and ILUT libraries, but when my software tries to link against it,
> GCC bombs out because it can't find IL link dependencies such as lcms or
> mng that are not installed on my system but are provided by my project, and
> it will use the system libpng / libz rather than my custom ones (not really
> a problem, but not expected either.)  Looking at FindDevIL.cmake, it does
> not attempt to search for these dependencies.  On the other hand, if I call
> FIND_PACKAGE ("PNG") it will correctly pick up my custom libz as a
> dependency and include it in PNG_LIBRARIES.
>
> Which of these two behaviors should be the "expected" one?  I'm in the
> process of writing a fair number of Find scripts so I want to do it the
> "right" way (and be able to build my project of course.)

I would go for the FindPNG.cmake one. 

> Incidentally, I'm writing Find scripts for the following libraries:
> CppUnit, LCMS, OGDI (an optional GDAL dependency with support for oddball
> military formats), ACE, TAO, MNG, PROJ4, Presagis OpenFlight, and a

We have a FindLCMS.cmake in KDE 
(http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/), and I think I have 
also seen find-scripts for MNG and CppUnit somewhere.

Alex


More information about the CMake mailing list