[CMake] Win32: exporting symbols for DLLs - simpler method ?

Clinton Stimpson clinton at elemtech.com
Fri Nov 23 11:04:43 EST 2007


Stephen Collyer wrote:
> Cmake seems to define, for each library that is built, a symbol
> of the form <library>_EXPORTS, which can be used to set up
> #defines for the __declspec(dllexport/dllimport) stuff that
> Windows needs.
>
> However, this means that each library needs a specific symbol
> to allow it to be built with the correct import/export spec e.g.
>
>
> class LIB1_EXPORTS Lib1 {
> ...
> }
>
> class LIB2_EXPORTS Lib2 {
> ...
> }
>
> and so on. What I'd like to do is to have a single #define
> (LIB_EXPORTS or something) that is set appropriately somehow.
>
> Is this possible ? I don't see how at the moment, but the
> method I'm using at the moment is rather tedious and I'd like
> to simplify it, if possible.
>
>   

Sounds like you're looking for the DEFINE_SYMBOL argument to 
SET_TARGET_PROPERTIES()

Clint




More information about the CMake mailing list