On 6/9/07, <b class="gmail_sendername">Stuart Herring</b> &lt;<a href="mailto:cmake@stuartherring.com">cmake@stuartherring.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;">
On 6/9/07, Clark J. Wang &lt;<a href="mailto:dearvoid@gmail.com">dearvoid@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt; but it failed to cmake. So how can I let two executables share one single<br>&gt; object file?<br>&gt;<br>
You don&#39;t really want to.<br>The cost of compiling the same source file twice is minimal, and it&#39;s<br>much safer to compile them separately - it means that if you later<br>need to add different compile flags for the two executables that you
<br>can without worry of one contaminating the other.</blockquote><div><br>This makes sense. Thank you.<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;">
However, you could always build a static library and create the<br>executable from that:<br><br>ADD_LIBRARY(hellomain STATIC main.c)<br>ADD_EXECUTABLE(hello1 hello1.c)<br>ADD_EXECUTABLE(hello2 hello2.c)<br><br>TARGET_LINK_LIBRARIES(hello1 hellomain)
<br>TARGET_LINK_LIBRARIES(hello2 hellomain)</blockquote><div><br>This really works but I prefer not using it. ;-) <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;">
Regards,<br>Stuart.<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">http://www.cmake.org/mailman/listinfo/cmake
</a></blockquote></div>