[CMake] GENERATE_EXPORT_HEADER

Sergiu Dotenco sergiu.dotenco at gmail.com
Wed Sep 5 11:27:05 EDT 2012


On 9/5/2012 3:52 PM, Micha Renner wrote:
> For static libraries the macro GENERATE_EXPORT_HEADER produce an output
> like this one:
> 
> ...
> #else
> #  ifndef CTEST_EXPORT
> #    ifdef cTest_EXPORTS
>         /* We are building this library */
> #      define CTEST_EXPORT 
> #    else
>         /* We are using this library */
> #      define CTEST_EXPORT 
> #    endif
> #  endif
> ...
> 
> For for a static version of a library CTEST_EXPORT is empty.
> 
> For Windows and the MSVC it is not always a good idea, since the MSVC
> can produce errors in this case.

What kind of errors? Are you sure that you're using the export macro
correctly?

> So I propose (static versions of libraries): For the MSVC and Windows
> CTEST_EXPORT should be defined with "extern", either by option or by
> default.

Applying extern to a class definition doesn't make any sense.


More information about the CMake mailing list