<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16825" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,
<DIV> </DIV>
<DIV>I have built a static library lib1 and test program lib1test using the
following CMAKE 2.6.2 commands without problems.</DIV>
<DIV> </DIV>
<DIV>INCLUDE_DIRECTORIES( /usr/local/boost_1_39_0 )<BR>ADD_LIBRARY( lib1 STATIC
${lib1_srcs} )</DIV>
<DIV> </DIV>
<DIV>ADD_EXECUTABLE( lib1test lib1test.cpp )<BR>LINK_DIRECTORIES( /usr/local/lib
) # boost stuff<BR>TARGET_LINK_LIBRARIES( lib1test lib1
boost_filesystem-gcc42-mt boost_system-gcc42-mt )<BR> </DIV>
<DIV>When attempting to build a 2nd static library lib2 (which uses code in
lib1) and test program lib2test with a similar script -</DIV>
<DIV> </DIV>
<DIV>INCLUDE_DIRECTORIES( /home/john/lib1/src )<BR>ADD_LIBRARY( lib2 STATIC
${lib2_srcs} )</DIV>
<DIV> </DIV>
<DIV>ADD_EXECUTABLE( lib2test lib2test.cpp )<BR>LINK_DIRECTORIES(
/home/john/lib1/src ) ## doesn't work here<BR>TARGET_LINK_LIBRARIES( lib2test
lib2 lib1 boost_filesystem-gcc42-mt boost_system-gcc42-mt)</DIV>
<DIV> </DIV>
<DIV>I get the following link
error<BR>/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../x86_64-suse-linux/bin/ld:
cannot find -llib1</DIV>
<DIV> </DIV>
<DIV>If LINK_DIRECTORIES is moved before ADD_EXECUTABLE -</DIV>
<DIV> </DIV>
<DIV>LINK_DIRECTORIES( /home/john/lib1/src ) ## works here<BR>ADD_EXECUTABLE(
lib2test lib2test.cpp )<BR>TARGET_LINK_LIBRARIES( lib2test lib2 lib1
boost_filesystem-gcc42-mt boost_system-gcc42-mt)</DIV>
<DIV> </DIV>
<DIV>lib2test links and executes.</DIV>
<DIV> </DIV>
<DIV>
<DIV>I would really appreciate some help with the following questions. </DIV>
<DIV> </DIV></DIV>
<DIV>
<DIV>1. Are the boost libraries statically or dynamically linked to
lib1test?</DIV>
<DIV> </DIV></DIV>
<DIV>2. Why does moving LINK_DIRECTORIES before ADD_EXECUTABLE appear to fix
things?</DIV>
<DIV> </DIV>
<DIV>3. The location of the boost libraries has not been specfied but lib2test
still links?</DIV>
<DIV> </DIV>
<DIV>TIA,</DIV>
<DIV> </DIV>
<DIV>John.<BR></DIV></FONT></DIV></BODY></HTML>