[CMake] Discovering ExternalProject library dependencies?
John Gallagher
johnkgallagher+cmake at gmail.com
Wed Apr 10 23:26:43 EDT 2013
Hello,
Is there a convenient way to have CMake detect at build time additional
libraries that need to be linked for an external project to work? For
example, suppose I have
ExternalProject_Add(Foo ...args...)
which builds libfoo.a (which is an autotools package). Depending on the
system on which libfoo is built, sometimes linking against it also requires
-labc, and other times it requires -lxyz. For normal users of libfoo, it
writes out a pkg-config file that sets an appropriate "Libs: ..." line. I'm
trying to figure out how to handle this in CMake. Possible options:
1. Have my project repeat the checks that libfoo does to discover whether
-labc or -lxyz is required. This is clearly doable but doesn't seem like
the right answer (duplicated checks, what if they change in the future,
etc.).
2. Use FindPkgConfig *after* Foo is built. I don't know if this is possible.
3. Use file(STRINGS ...) on the .pc file that Foo writes out and parse out
the Libs line "manually".
Does anyone have any suggestions on the right thing to do here?
Thanks,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130410/d48e13d9/attachment.htm>
More information about the CMake
mailing list