On 6/9/07, <b class="gmail_sendername">Clark J. Wang</b> &lt;<a href="mailto:dearvoid@gmail.com">dearvoid@gmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
For example, I have a project `test&#39; which needs a 3rd-party software `hello&#39;. The directory structure looks like this:<br><br>test/test.c<br>test/CMakeLists.txt<br>test/build&nbsp;&nbsp;&lt;-- I run cmake in this directory
<br>
test/hello/hello.c<br>test/hello/main.c<br>test/hello/Makefile</blockquote><div><br>Another question:<br><br>By default `make clean&#39; does not know how to clean the 3rd-party package. How can I add another command which will be run by `make clean&#39;?
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">hello&#39;s Makefile will create a lib `test/hello/libhello.so&#39; and an exe `test/hello/hello&#39;. `test/test.c&#39; depends on `libhello.so&#39; to compile.
<br>I write a CMakeLists.txt like this but it does not work:<br><br>### BEGIN ###<br><br>PROJECT(test)<br><br>SET(CMAKE_VERBOSE_MAKEFILE ON)<br><br>SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)<br>SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
<br><br>LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH})<br><br>SET(hellodir ${PROJECT_SOURCE_DIR}/hello)<br>SET(hellolib ${LIBRARY_OUTPUT_PATH}/libhello.so)<br>SET(helloexe ${EXECUTABLE_OUTPUT_PATH}/hello)<br>ADD_CUSTOM_COMMAND(
<br>&nbsp;&nbsp;&nbsp;&nbsp;OUTPUT ${hellolib} ${helloexe}<br>&nbsp;&nbsp;&nbsp;&nbsp;COMMAND make -C ${hellodir}<br>&nbsp;&nbsp;&nbsp;&nbsp;COMMAND cp ${hellodir}/libhello.so ${hellolib}<br>&nbsp;&nbsp;&nbsp;&nbsp;COMMAND cp ${hellodir}/hello ${helloexe}<br>)<br><br>ADD_EXECUTABLE(test test.c)<br>TARGET_LINK_LIBRARIES(test ${hellolib})
<br><br>### END ###<br><br>Following is the output of make:<br><br>$ make<br>/usr/local/cmake-2.4.6/bin/cmake -H/root/tmp/cmake -B/root/tmp/cmake/b --check-build-system CMakeFiles/Makefile.cmake 0<br>/usr/local/cmake-2.4.6

/bin/cmake -E cmake_progress_start /root/tmp/cmake/b/CMakeFiles 1<br>make -f CMakeFiles/Makefile2 all<br>make[1]: Entering directory `/root/tmp/cmake/b&#39;<br>make -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/depend
<br>make[2]: Entering directory `/root/tmp/cmake/b&#39;<br>Scanning dependencies of target test<br>cd /root/tmp/cmake/b &amp;&amp; /usr/local/cmake-2.4.6/bin/cmake -E cmake_depends &quot;Unix Makefiles&quot; /root/tmp/cmake /root/tmp/cmake /root/tmp/cmake/b /root/tmp/cmake/b /root/tmp/cmake/b/CMakeFiles/test.dir/DependInfo.cmake
<br>make[2]: Leaving directory `/root/tmp/cmake/b&#39;<br>make -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/build<br>make[2]: Entering directory `/root/tmp/cmake/b&#39;<br>/usr/local/cmake-2.4.6/bin/cmake -E cmake_progress_report /root/tmp/cmake/b/CMakeFiles 1
<br>[100%] Building C object CMakeFiles/test.dir/test.o<br>/usr/bin/gcc&nbsp;&nbsp; -o CMakeFiles/test.dir/test.o&nbsp;&nbsp; -c /root/tmp/cmake/test.c<br>make[2]: *** No rule to make target `lib/libhello.so&#39;, needed by `bin/test&#39;. Stop.
<br>make[2]: Leaving directory `/root/tmp/cmake/b&#39;<br>make[1]: *** [CMakeFiles/test.dir/all] Error 2<br>make[1]: Leaving directory `/root/tmp/cmake/b&#39;<br>make: *** [all] Error 2<br>$<br><br>So, how can I integrate 3rd-party software into my own project?
<br><br>Thank you.<br>
</blockquote></div><br>