thanks.  its not a real problem, but if I didn't have to compile
twice that would obviously be better :-)  Right now I just tack on
-static to the target name and have two targets.  I'm basically
trying to loosely simulate the autotools functionality where you can
independently switch on/off shared and static (--disable-shared
--enable-static).<br><br>
<br><div><span class="gmail_quote">On 8/3/05, <b class="gmail_sendername">David Cole</b> &lt;<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Not in general. You'll want two distinct binary trees for this. On some<br>platforms, the compile stage is different for the two types of<br>libraries. And on Windows, specifically, creating a shared library (dll)<br>also produces an import library (lib) which clients of the library need
<br>to link to. So, if you tried to build both, you'd end up with two<br>target.lib files (one the &quot;real&quot; static lib and one an import lib which<br>links the client to the dll) and somebody somewhere would get confused...
<br><br>Is there a problem with &quot;re-running cmake&quot;? And using two separate<br>binary directories, one for static, one for shared? (Other than the fact<br>that your build has to be twice as long when you have two binary trees
<br>to produce...)<br><br>HTH,<br>David<br><br><br>Doug Henry wrote:<br><br>&gt; is it possible to build a static and shared library (without<br>&gt; re-running cmake) for the same target?&nbsp;&nbsp;Something like:<br>&gt;<br>&gt; ADD_LIBRARY(target STATIC ...)
<br>&gt; ADD_LIBRARY(target SHARED ...)<br>&gt;<br>&gt; cmake doesn't allow add_library twice for the same target, so it sort<br>&gt; of makes sense that the above doesn't work, even though they create<br>&gt; different files.&nbsp;&nbsp;Any info appreciated.
<br>&gt;<br>&gt; -doug<br>&gt;<br>&gt;------------------------------------------------------------------------<br>&gt;<br>&gt;_______________________________________________<br>&gt;CMake mailing list<br>&gt;<a href="mailto:CMake@cmake.org">
CMake@cmake.org</a><br>&gt;<a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br>&gt;<br>&gt;<br><br></blockquote></div><br>