[CMake] How to build a shared library

Brad King brad.king at kitware.com
Mon Feb 7 08:41:11 EST 2005


Pavan Podila wrote:
>    Can someone explain to me how I can build shared libraries under 
> CMake. I am using Windows XP as my dev env. In my ADD_LIBRARY command I 
> set the flag to SHARED. However at link time I am getting linker errors. 
> I am sure I am missing something. Your help is greatly appreciated.

On Windows DLL's (the Windows version of shared libraries), the set of 
symbols usable by outside libraries (exported symbols) must be 
explicitly specified.  Use __declspec(dllexport) on declarations you 
want to export.  A google search should produce sufficient examples for you.

-Brad


More information about the CMake mailing list