Thanks for the reply.<br><br>I added &quot;add_dependencies( lib1 lib2 )&quot;,
&quot;add_dependencies( lib2 lib1 )&quot;, and &quot;add_dependencies( execthing lib1
lib2 )&quot; in their appropriate places, and changed the libraries to
STATIC, but no change.<br>
<br>Yes, everything compiles when i build the libraries and executables
separately; it fails on the link step after this, with &quot;undefined
reference&quot; to every library function used.<br><br>I&#39;m unfamiliar with &#39;nm&#39;, can you be more specific as to what I should be looking for?<br><br><br><div class="gmail_quote">On Tue, Jun 16, 2009 at 4:55 PM, Tyler Roscoe <span dir="ltr">&lt;<a href="mailto:tyler@cryptio.net">tyler@cryptio.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On Tue, Jun 16, 2009 at 03:41:51PM -0500, Mark Lohry wrote:<br>

&gt; I have a number of subdirectories, each containing source to be built into<br>
&gt; their own libraries, which contain many interdependencies. I&#39;m trying to<br>
&gt; build an executable to link against these libraries, and I&#39;m getting a<br>
&gt; console full of &quot;undefined reference to...&quot; errors on linking step. The<br>
&gt; libraries and executable source all compile individually without issue.<br>
&gt;<br>
&gt; Structure is like so:<br>
&gt;<br>
&gt; # top-level CMakeLists.txt<br>
&gt; project( proj )<br>
&gt; ADD_SUBDIRECTORY( lib )<br>
&gt; ADD_SUBDIRECTORY( src )<br>
&gt;<br>
&gt;<br>
&gt; # /lib/CMakeLists.txt<br>
&gt; ADD_SUBDIRECTORY( lib1 )<br>
&gt; ADD_SUBDIRECTORY( lib2 )<br>
&gt;<br>
&gt;<br>
&gt; # /lib/lib1/CMakeLists.txt<br>
&gt; include_directories( ${proj_SOURCE_DIR}/lib )<br>
&gt; set( lib1_SRCS<br>
&gt;   ..... bunch of c++ sources )<br>
&gt; add_library( lib1 SHARED ${lib1_SRCS} )<br>
&gt;<br>
&gt;<br>
&gt; # /lib/lib2/CMakeLists.txt<br>
&gt; include_directories( ${proj_SOURCE_DIR}/lib )<br>
&gt; set( lib2_SRCS<br>
&gt;   ..... bunch of c++ sources )<br>
&gt; add_library( lib2 SHARED ${lib2_SRCS} )<br>
&gt;<br>
&gt;<br>
&gt; # src/CMakeLists.txt<br>
&gt; include_directories( ${proj_SOURCE_DIR}/lib )<br>
&gt; set( execthing_SRCS<br>
&gt;  .... bunch of C++ sources )<br>
&gt; add_executable( execthing ${execthing_SRCS} )<br>
&gt; target_link_libraries( execthing lib1 lib2 )<br>
<br>
</div></div>This all looks reasonable to me, so the devil is probably in the<br>
details. Are you sure all your paths make sense? Can you use nm or<br>
dumpbin or whatever to see the &quot;undefined&quot; symbols in the libraries<br>
where you expect to find them?<br>
<br>
So if you build the libraries individually and then build the executable<br>
individually, everything works? You might try playing with some explicit<br>
add_dependencies() to see if there&#39;s some kind of build order problem.<br>
CMake should be smart enough to figure this out from your<br>
target_link_libraries, but maybe you have something strange going on<br>
under the covers?<br>
<font color="#888888"><br>
tyler<br>
</font></blockquote></div><br>