[CMake] can't link against multiply dependent static libraries with
CHECK_LIBRARY_EXISTS
Philip Lowman
philip at yhbt.com
Mon Feb 12 18:05:19 EST 2007
Hi,
I'm using CMake 2.4.6. I'm trying to use CHECK_LIBRARY_EXISTS to verify
a function exists in a static library that requires additional static
libraries to be linked against in order for main() to link.
libctdb depends in part on libgcs, libgtrs, and libvecmat (which need to
be linked in that order).
SET(CMAKE_REQUIRED_LIBRARIES "libctdb.a;libgcs.a;libgtrs.a;libvecmat.a")
CHECK_LIBRARY_EXISTS(ctdb ctdb_lookup_attr_name
${PROJECT_SOURCE_DIR}/Ctdbase/otb/lib HAVE_CTDB)
I get the following error message in CMakeFiles/CMakeError.log:
/usr/bin/gcc -DCHECK_FUNCTION_EXISTS=ctdb_lookup_attr_name -fPIC
"CMakeFiles/cmTryCompileExec.dir/usr/local/cmake/share/cmake-2.4/Modules/CheckFunctionExists.o"
-o cmTryCompileExec -rdynamic
-L/home/lowmanp/src/gres.cmake/Ctdbase/otb/lib -lctdb -Wl,-Bstatic
-lctdb -lgcs -lgtrs -lvecmat -Wl,-Bdynamic
-Wl,-rpath,/home/lowmanp/src/gres.cmake/Ctdbase/otb/lib
I can link a simple main() .c file of my own choosing using this gcc
line and it works just fine.
g++ -I/home/lowmanp/src/gres.cmake/Ctdbase/otb
-I/home/lowmanp/src/gres.cmake/Ctdbase/otb/include
-I/home/lowmanp/src/gres.cmake/Ctdbase/otb/include/global
-I/home/lowmanp/src/gres.cmake/Ctdbase/otb/include/libinc crap.c
-L/home/lowmanp/src/gres.cmake/Ctdbase/otb/lib -lctdb -lgcs -lgtrs
-lvecmat -o crap
--
Philip Lowman
Simulation Development Engineer, Modeling and Simulation Technology
General Dynamics Land Systems
http://www.gdls.com
More information about the CMake
mailing list