diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -302,7 +302,9 @@ # 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.