summaryrefslogtreecommitdiff
path: root/libcxxabi/CMakeLists.txt
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2022-03-07 13:32:52 -0500
committerLouis Dionne <ldionne.2@gmail.com>2022-03-07 15:36:04 -0500
commitebde6fc23bc0ee9d022fcd26b52bc82dfb7c8468 (patch)
treeb67911fbc0e4961c7de1b747a525ed205e000e37 /libcxxabi/CMakeLists.txt
parentbed3240bf7d196a17cc31f1c5b59b4721017e638 (diff)
downloadllvm-ebde6fc23bc0ee9d022fcd26b52bc82dfb7c8468.tar.gz
[libcxxabi] Fix cmake order dependency wrt dllexporting
If LIBCXX_ENABLE_SHARED isn't explicitly set on the cmake command line, isn't set in the cache, and the libcxxabi project is configured before libcxx, then LIBCXX_ENABLE_SHARED isn't defined yet. Once the libcxx cmake project has been parsed, LIBCXX_ENABLE_SHARED would have been set to its default value of ON. This makes sure that the symbols are properly dllexported in such a configuration scenario. Differential Revision: https://reviews.llvm.org/D120982
Diffstat (limited to 'libcxxabi/CMakeLists.txt')
-rw-r--r--libcxxabi/CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index a7e8444e5a19..bf9f112d1623 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -302,13 +302,20 @@ add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
# Disable DLL annotations on Windows for static builds.
if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
- if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
+ # If LIBCXX_ENABLE_SHARED isn't set (by the user on the cmake command
+ # line or via a cache file), use its expected default value (enabled).
+ if ((LIBCXX_ENABLE_SHARED OR NOT DEFINED LIBCXX_ENABLE_SHARED) AND LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
# Building libcxxabi statically, but intending for it to be statically
# linked into a shared libcxx; keep dllexport enabled within libcxxabi,
# as the symbols will need to be exported from libcxx.
else()
# Regular static build; disable dllexports.
add_definitions(-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
+ if (NOT LIBCXXABI_HERMETIC_STATIC_LIBRARY)
+ # TODO: Enable this warning message as soon as we're sure this is the solution.
+ # message(WARNING "Implicitly disabling dllexport on Win32 is not supported anymore. Please build with "
+ # "LIBCXXABI_HERMETIC_STATIC_LIBRARY=ON instead. This will become an error in LLVM 16.")
+ endif()
endif()
endif()