[CMake] Find scripts and dependent libraries

Gregory Peele ARA/CFD gpeele at ara.com
Tue Apr 21 08:55:44 EDT 2009


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.)

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 FindUUID script which attempts to determine the "native" support for UUID manipulation (e.g. Rpcrt4.lib on Windows, e2fslibs libuuid on Linux) and reports which style of UUIDs it found as well as necessary link and include options.  I would be happy to submit any of them if there's interest, but they're only really tested for my particular project on Linux and Windows.

Thanks,
Gregory Peele, Jr.
Applied Research Associates, Inc.


More information about the CMake mailing list