[CMake] intercomponent link dependencies?

Nico Schlömer nico.schloemer at gmail.com
Fri Jan 8 05:00:06 EST 2010


Hi,

> I am guessing that
> you're putting the detection for every library that your app can/must use
> into one "find" module, when you actually probably should have a directory
> in your source tree added to your CMAKE_MODULE_PATH that contains a large
> number of find modules, some of which are interdependent (just like how the
> example I sent uses find_package(BLAS) - which is a module that comes
> bundled with cmake).

-- Exactly!

I'm thinking now that this is indeed a good solution: Writing
*separate* FindLibraryX.cmake files for all the libraries included in
MyPackage and putting all the dependency information in there; then,
make a meta .cmake file which will allow for specifying the keyword
COMPONENTS, and where all the meta information goes (e.g., version
number of MyPackage).

Minor drawbacks of this approach I find would be that the fact that
all those libraries live under one roof is entirely discarded, that
is, that they all share a common LIB directory, INCLUDE directory, all
have the same version string (namely the one of MyPackage). Plus also,
new libraries included require their own new FindNewLib.cmake to be
created, while all FindLibrary*.cmake would actually be the same file,
except for the dependency info (nasty (?) code duplication).

How I came to think about COMPONENTS in the first place was looking at
FindBoost.cmake which I *thought does what I'm doing -- except for the
intercomponent linking info.

Cheers!
Nico


More information about the CMake mailing list