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

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to