WINDOWS_EXPORT_ALL_SYMBOLS.rst 1.3 KB

1234567891011121314151617181920212223242526
  1. WINDOWS_EXPORT_ALL_SYMBOLS
  2. --------------------------
  3. This property is implemented only for MS-compatible tools on Windows.
  4. Enable this boolean property to automatically create a module definition
  5. (``.def``) file with all global symbols found in the input ``.obj`` files
  6. for a ``SHARED`` library (or executable with :prop_tgt:`ENABLE_EXPORTS`)
  7. on Windows. The module definition file will be passed to the linker
  8. causing all symbols to be exported from the ``.dll``.
  9. For global *data* symbols, ``__declspec(dllimport)`` must still be used when
  10. compiling against the code in the ``.dll``. All other function symbols will
  11. be automatically exported and imported by callers. This simplifies porting
  12. projects to Windows by reducing the need for explicit ``dllexport`` markup,
  13. even in ``C++`` classes.
  14. When this property is enabled, zero or more ``.def`` files may also be
  15. specified as source files of the target. The exports named by these files
  16. will be merged with those detected from the object files to generate a
  17. single module definition file to be passed to the linker. This can be
  18. used to export symbols from a ``.dll`` that are not in any of its object
  19. files but are added by the linker from dependencies (e.g. ``msvcrt.lib``).
  20. This property is initialized by the value of
  21. the :variable:`CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS` variable if it is set
  22. when a target is created.