[CMake] Dll API in static build

David Cole david.cole at kitware.com
Wed May 16 22:30:38 EDT 2012


Using the keyword SHARED in the add_library command will always build a shared library regardless of the BUILD_SHARED_LIBS value.



On May 16, 2012, at 6:15 PM, Totte Karlsson <totte at dunescientific.com> wrote:

> Hi,
> I am building a C++ library, using Cmake. When creating the build files from CMkae UI, I have a BUILD_SHARED_LIBS option, allowing the user to create a static, or a dll version of the library.
> 
> In addition to the 'main' library, and in the same Cmkae project, I have a C wrapper, that should always be compiled as a dll, linked to the main library (static or shared).
> 
> When un-checking the build shared libs option, the C API is built as a static lib. I guess that makes sense. But how can one over ride this, and force the C api to always be build as a shared lib?
> 
> -totte
> -- 
> .........................
> Totte Karlsson, Ph.D.
> Dune Scientific, LLC
> 425-296 1980 (office)
> 425-780 9648 (cell)
> www.dunescientific.com
> .........................
> 
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list