<p dir="ltr">A static lib does what you want and won&#39;t introduce any extra runtime dependecies</p>
<div class="gmail_quote">On 22 Apr 2013 19:45, &quot;Nick Gnedin&quot; &lt;<a href="mailto:ngnedin@gmail.com">ngnedin@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Folks,<br>
<br>
I am using CMake to create 2 targets - a stand-alone executable and a library that can be imported by Python. Both share most of the sources. If I just specify them as two separate targets, each will compile all the sources, so most of the source files end up compiled twice.<br>

<br>
Is there a way to share the compiled sources between the two targets? I can create an intermediate library, but that is less convenient since the executable will then depend on it. What I would really like is to have a self-contained executable and a separate library that use the same object files.<br>

<br>
Many thanks for any hint,<br>
<br>
Nick Gnedin<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/<u></u>listinfo/cmake</a><br>
</blockquote></div>