google / google/cctz

cmake windows shared builds do not export symbols

Open
#72 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
654
Forks
178
Avg merge
4d 22h
Merged PRs (30d)
6

Description

When building shared libs on windows, using cmake and `-DBUILD_SHARED_LIBS=On`, no .lib file is produced, which in turn doesn't allow a consumer to link against cctz.

Ideally, symbols should be properly exported (see https://msdn.microsoft.com/en-us/library/a90k134d.aspx), then a lib file will be generated.

A not-so-elegant, but working solution may be to enable: `CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS`, which I had success with, however for optimal results you should only export what should be exported.

This workaround is as simple as adding:

`set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES CACHE BOOL "Export all symbols")`

or running the cmake config command with `-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=True`

thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.