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> <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> 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 "real" 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 "re-running cmake"? 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>> is it possible to build a static and shared library (without<br>> re-running cmake) for the same target? Something like:<br>><br>> ADD_LIBRARY(target STATIC ...)
<br>> ADD_LIBRARY(target SHARED ...)<br>><br>> cmake doesn't allow add_library twice for the same target, so it sort<br>> of makes sense that the above doesn't work, even though they create<br>> different files. Any info appreciated.
<br>><br>> -doug<br>><br>>------------------------------------------------------------------------<br>><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><br>><br>><br><br></blockquote></div><br>