[runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows
authorMartin Storsjö <martin@martin.st>
Sat, 9 Apr 2022 20:40:07 +0000 (23:40 +0300)
committerMartin Storsjö <martin@martin.st>
Wed, 18 May 2022 17:31:51 +0000 (20:31 +0300)
commitbedf657d0f4c54ffe9ef4303382657a74296b544
treebbe271357458b94be3b96fa7a703e6e949afca6c
parent86f7d7074a0129955aa2f5c82fe8c383eb17a35a
[runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows

(In the case of libunwind, the cmake option is called
LIBUNWIND_HIDE_SYMBOLS, but it has the same effect as
LIBCXX_HERMETIC_STATIC_LIBRARY and
LIBCXXABI_HERMETIC_STATIC_LIBRARY.)

Previously, the same issue was dealt with by setting a project wide
define (_LIBUNWIND_HIDE_SYMBOLS,
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS and
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) if only building a static
library.  If building both static and shared at the same time, this
wasn't set, and the static library would contain dllexport directives.

The LIB*_HERMETIC_STATIC_LIBRARY and LIBUNWIND_HIDE_SYMBOLS cmake
options only apply the defines to the static library in the build,
even if building both static and shared at the same time.

(This could only be done use after the object libraries were
enabled, as a shared libcxx needs libcxxabi object files built
with dllexports included.)

This allows removing inelegant code for deciding how to build the
libcxxabi static library and a TODO comment that suggested that
users should need to start setting an option, which they shouldn't
need to. Finally, this gets rid of two XFAILs in tests.

Differential Revision: https://reviews.llvm.org/D125715
libcxx/CMakeLists.txt
libcxx/src/CMakeLists.txt
libcxx/test/libcxx/vendor/clang-cl/static-lib-exports.sh.cpp
libcxx/test/libcxx/vendor/mingw/static-lib-exports.sh.cpp
libcxxabi/CMakeLists.txt
libcxxabi/src/CMakeLists.txt
libunwind/CMakeLists.txt