[CMake] Dependency on external library

William A. Hoffman billlist at nycap.rr.com
Wed Oct 6 11:47:13 EDT 2004


It is going to have to be a full path to the library otherwise how
the depend be put in.  If you use the FIND_LIBRARY command in cmake
to set the library, then it should work.

FIND_LIBRARY(XYZ_LIB Xyz)
TARGET_LINK_LIBRARY(targetX ${XYZ_LIB})

Cmake will use the .a .so or .lib as appropriate.

-Bill


At 11:39 AM 10/6/2004, Anton Deguet wrote:
>On Wed, 2004-10-06 at 11:13, William A. Hoffman wrote:
>> I think if you add the library as a full path it should work.
>> I added this feature at some point.  What version of cmake, and
>> what generator are you using?
>
>I'm using CMake 2.0.3 for Makefile/icc, Makefile/gcc, Windows/.net 2000 and Windows/.net 2003.
>I am afraid the full name and path will be an issue since the name of the library can be either libXyz.a, libXyz.so or Xyz.lib.
>I was thinking of a way to use the library name as it can be used in
>TARGET_LINK_LIBRARY(targetX Xyz)
>ADD_DEPENDENCIES(targetX Xyz)
>
>Maybe with an extra keyword
>ADD_DEPENDENCIES(targetX library Xyz)
>
>Anton
>
>
>> At 10:23 AM 10/6/2004, Anton Deguet wrote:
>> >Hello,
>> >
>> >I am using the command TARGET_LINK_LIBRARIES to specify which libraries
>> >to link with.  Unfortunately one of the libraries is often recompiled
>> >(not using CMake) and CMake doesn't seem to handle the dependency
>> >correctly (i.e. the executable is not relinked when this external
>> >library is modified).   Is there an easy way to add this kind of
>> >dependency?
>> >
>> >Anton
>> >
>> >
>> >-- 
>> >Anton Deguet                          Systems Engineer
>> >ERC CISST                     Johns Hopkins University
>> >http://cisstweb.cs.jhu.edu                410 516 5261
>> >
>> >_______________________________________________
>> >CMake mailing list
>> >CMake at www.cmake.org
>> >http://www.cmake.org/mailman/listinfo/cmake
>> 
>> _______________________________________________
>> CMake mailing list
>> CMake at www.cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>-- 
>Anton Deguet                          Systems Engineer
>ERC CISST                     Johns Hopkins University
>http://cisstweb.cs.jhu.edu                410 516 5261



More information about the CMake mailing list