[CMake] GENERATE_EXPORT_HEADER

Micha Renner Micha.Renner at t-online.de
Wed Sep 5 09:52:46 EDT 2012


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.

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.

Greeting

Micha




More information about the CMake mailing list