Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -522,6 +522,17 @@ config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL) config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC) +# Indicate the ABI that we are targeting. If the c++abi library is none and we +# are building for windows, assume that we want the Microsoft C++ ABI. Note +# that MinGW uses the itanium ABI and still reports as WIN32 under CMake. If we +# are targeting the itanium ABI, then we must have one of the itanium ABI +# support libraries (libc++abi, libsupc++, or libcxxrt). Windows itanium and +# MinGW both will use one of those to provide the support routines which +# differentiates it from MS ABI. +if(WIN32 AND NOT MINGW AND "${LIBCXX_CXX_ABI}" STREQUAL "none") + config_define_if(TRUE _LIBCPP_USES_MS_ABI) +endif() + # By default libc++ on Windows expects to use a shared library, which requires # the headers to use DLL import/export semantics. However when building a # static library only we modify the headers to disable DLL import/export. Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -33,6 +33,12 @@ #define _LIBCPP_ABI_VERSION 1 #endif +#if defined(_LIBCPP_USES_MS_ABI) +#define _LIBCPP_ABI_MS +#else +#define _LIBCPP_ABI_IA +#endif + #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. Index: include/__config_site.in =================================================================== --- include/__config_site.in +++ include/__config_site.in @@ -22,5 +22,6 @@ #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL #cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS +#cmakedefine _LIBCPP_USES_MS_ABI #endif // _LIBCPP_CONFIG_SITE