[CMake] organizing export link libraries

Nico Schlömer nico.schloemer at gmail.com
Wed Aug 20 13:46:50 EDT 2014


Hi all,

a general question:
I have a dependency chain of libraries

A -> B -> C -> ... -> Z

and all of those libraries are built with CMake, using CMake's export
functionality [1] to let the next in the chain know about its the
dependencies.
If all of the libraries are built statically and A needs some symbols
from a third-party library A1, this information needs to travel to Z.
Right now, in the export file I'm writing out the link line as

set(a_EXTRA_LIBS -lhdf5 -lhdf5_hl -ldl -lm -lz -lcurl)

and then in B

set(b_EXTRA_LIBS "<some other libs> -lhdf5 -lhdf5_hl -ldl -lm -lz -lcurl")

and so on.
Is that the preferred way to handle this in CMake? Any other recommendations?

Cheers,
Nico


[1] http://www.cmake.org/cmake/help/v3.0/module/CMakePackageConfigHelpers.html


More information about the CMake mailing list