<div>You do not need an &quot;add_dependencies&quot; call after the add_executable, you need a &quot;target_link_libraries&quot; to tell the exe to link in the library...</div><div><br></div><div>HTH,</div><div>David</div>
<div><br></div><div><div class="gmail_quote">On Fri, Nov 14, 2008 at 1:23 PM, Neal Meyer <span dir="ltr">&lt;<a href="mailto:nmeyer@dottedzebra.com">nmeyer@dottedzebra.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I built an extremely simple project.&nbsp; Contains main.cpp, and then a library with widget.cpp init.&nbsp; here is the CMakeLists.txt that I&#39;m using<br><br>project( c++_cmd_line )<br>CMAKE_MINIMUM_REQUIRED(VERSION 2.6)<br><br>

#setup the output directories<br>set( LIB_OUT_DIR ${CMAKE_BINARY_DIR}/bin/lib )<br>set( EXE_OUT_DIR ${CMAKE_BINARY_DIR}/bin )<br>set( EXECUTABLE_OUTPUT_PATH ${EXE_OUT_DIR} )<br>set( LIBRARY_OUTPUT_PATH ${LIB_OUT_DIR} )<br>

<br>add_library( widget STATIC widget.h widget.cpp )<br>add_executable( c++_cmd_line main.cpp ) <br><br>add_dependencies( c++_cmd_line widget )<br><br><br>main.cpp is just Hello world that calls a couple made up functions in the widget class to get the dependencies.&nbsp; And here is what the make spits out<br>

<br>Scanning dependencies of target widget<br>[ 50%] Building CXX object CMakeFiles/widget.dir/widget.cpp.o<br>Linking CXX static library bin/lib/libwidget.a<br>[ 50%] Built target widget<br>Scanning dependencies of target c++_cmd_line<br>

[100%] Building CXX object CMakeFiles/c++_cmd_line.dir/main.cpp.o<br>Linking CXX executable bin/c++_cmd_line<br>Undefined symbols:<br>&nbsp; &quot;Widget::get_i()&quot;, referenced from:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _main in main.cpp.o<br>&nbsp; &quot;Widget::get_j()&quot;, referenced from:<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _main in main.cpp.o<br>&nbsp; &quot;Widget::Widget()&quot;, referenced from:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _main in main.cpp.o<br>ld: symbol(s) not found<br>collect2: ld returned 1 exit status<br>make[2]: *** [bin/c++_cmd_line] Error 1<br>make[1]: *** [CMakeFiles/c++_cmd_line.dir/all] Error 2<br>

make: *** [all] Error 2<br><br>I&#39;ve tried moving the build directory around and even running cmake directly in my source directory, but to no avail.<br><font color="#888888"><br>-Neal</font><div><div></div><div class="Wj3C7c">
<br><br><br><div class="gmail_quote">On Fri, Nov 14, 2008 at 5:16 AM, Michael Jackson <span dir="ltr">&lt;<a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.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><br>
On Nov 13, 2008, at 7:59 PM, Neal Meyer wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
I have a project that I have been working on for a while using the Visual Studio generator in Windows, and I am now attempting to build in on Mac. &nbsp;Right now it&#39;s very early and I&#39;m having problems building any of the executables using the Unix Makefile generation or the XCode generator. &nbsp;It&#39;s basically just a couple of static libraries, that need to get linked into to build the executable. &nbsp;I have set them up as dependencies in the CMake files, and in XCode they show as dependencies, and the Unix builds them in the proper order. &nbsp;But it doesn&#39;t appear to try to link them in via the make files. &nbsp;I&#39;m makefile illiterate so there maybe something I&#39;m missing in them.<br>



<br>
Is there anywhere I could start to try to figure out what&#39;s wrong?<br>
<br>
-Neal<br>
</blockquote>
<br></div></div>
Do you get a link error when you try to compile? Does the code compile at all? Can yo post the error messages to the list?<br>
<br>
<br>
_________________________________________________________<br>
Mike Jackson &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a><br>
BlueQuartz Software &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
Principal Software Engineer &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dayton, Ohio<br>
<br>
<br>
<br>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>