[CMake] Re: Lib dependencies discovery
Pascal Fleury
fleury at users.sourceforge.net
Tue Apr 24 20:27:50 EDT 2007
On Wednesday 25 April 2007 02:04:15 Matthew Woehlke wrote:
> Pascal Fleury wrote:
> In my project, I wrote this macro:
>
> MACRO(CHECK_LIBRARY LIB_NAME LIB_DESC LIB_TEST_SOURCE)
Sorry that I cannot express my problem more clearly ;-)
I have this in place, but there are some tests that are spead over multiple
CMakeLists.txt files. At some point, at the end of the processing of these
CMakeLists.txt I would like to access the collected information about what
macros such as yours did find. Some of these libs depend on user flags, to
include/exclude some modules, and hence changing the list of libraries that
would need linking later on.
Example:
user 1 compiles the mainlib with default flags, which include the networking
component. When she wants to link her app against the produced mainlib.(a|
lib), she will need the socket/ws2_32.lib lib as well.
user 2 compiles the mainlib with the flag -DNETWORK_SUPPORT=OFF, so that the
networking component is not present in the mainlib. When user 2 wants to link
her own app to this mainlib, the socket/ws2_32.lib is actually not needed for
the application to link properly.
So in mainlib's CMakeLists.txts, how can I find out what the resulting list of
libs would be, depending on the user flags and/or the discoveries cmake did
for me ? (besides maintaining a parallel list to what cmae already manages)
I currently am using the 'mainlib_LIB_DEPENDS', which seem to contain
a ';'-separated list of libs, with some quirks (some are absolute paths, some
are just the name, some have leading '-l' etc.) I cleanup this list, and put
this into the pkg-config, that is then picked up by the application's
cmakelists.txt files that link the app. Is that mainlib_LIB_DEPENDS variable
portable ?
--
--paf
More information about the CMake
mailing list