[CMake] Writing out dependencies
Joseph Winston
josephwinston at mac.com
Mon Dec 3 17:56:15 EST 2007
I'm a cmake novice, so please forgive any misconceptions that I have.
I'm attempting to use cmake for a project that contains multiple
libraries, which in turn have dependencies on libraries both inside
the project and outside. For example, let's call the project "a" and
it has two libraries named "one" and "two". "two" depends on "one"
and one then needs Motif, Xt, X11, etc to link. What is the best way
to export the information needed to compile and link these different
libraries so that another version of cmake can use "two" and
"everything just works"?
I tried EXPORT_LIBRARY_DEPENDENCIES and while this writes out "one"
and "two"'s libraries it does not give me any information on how the
code was compiled. I have also attempted to use:
CONFIGURE_FILE("one.pc.cmake" "${CMAKE_BINARY_DIR}/one.pc" @ONLY)
INSTALL(FILES "${CMAKE_BINARY_DIR}/one.pc" DESTINATION $
{PKGCONFIG_INSTALL_PREFIX})
Where one.pc.cmake contains:
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@LIB_INSTALL_DIR@
includedir=@MOTIF_INCLUDE_DIR@
Name: one
Description: one library
Version:
Requires:
Libs: -L at X11_LIBRARY_DIR@ @MOTIF_LIBRARIES@ @X11_Xt_LIB@ @X11_LIBRARIES@
Cflags: @CMAKE_C_FLAGS@ -I${includedir}
This is a bit better since Cflags now contains the -D commands but it
still is missing the compiler options.
The show stopping problem with this idea is that Libs: is not in a
form that pkg-config can use since it contains:
Libs: -L/usr/lib64 /usr/lib64/libXm.so /usr/lib64/libXt.so -lSM;/usr/
lib64/libICE.so;/usr/lib64/libX11.so;/usr/lib64/lib/Xext.so
What should I be doing?
More information about the CMake
mailing list