The Windows support requires building with clang-cl as cl does not support one
required extension: #include_next. Furthermore, VS 2015 or newer (19.00) is
required. In the case of clang-cl, we need to specify the “MS Compatibility
Version” as it defaults to 2014 (18.00).

Here are some of the CMake variables that are used often, along with a
brief explanation and LLVM-specific notes. For full documentation, check the
CMake docs or execute cmake--help-variableVARIABLE_NAME.

CMAKE_BUILD_TYPE:STRING

Sets the build type for make based generators. Possible values are
Release, Debug, RelWithDebInfo and MinSizeRel. On systems like Visual Studio
the user sets the build type with the IDE settings.

CMAKE_INSTALL_PREFIX:PATH

Path where LLVM will be installed if “make install” is invoked or the
“INSTALL” target is built.

Build the libc++ benchmark tests and Google Benchmark library against the
specified standard library on the platform. On linux this can be used to
compare libc++ to libstdc++ by building the benchmark tests against both
standard libraries.

Pick the default for whether to constrain ABI-unstable symbols to
each individual translation unit. This setting controls whether
_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT is defined by default –
see the documentation of that macro for details.

You can also substitute -DLIBCXX_CXX_ABI=libsupc++
above, which will cause the library to be linked to libsupc++ instead
of libstdc++, but this is only recommended if you know that you will
never need to link against libstdc++ in the same executable as libc++.
GCC ships libsupc++ separately but only as a static library. If a
program also needs to link against libstdc++, it will provide its
own copy of libsupc++ and this can lead to subtle problems.

Unfortunately you can’t simply run clang with “-stdlib=libc++” at this point, as
clang is set up to link for libc++ linked to libsupc++. To get around this
you’ll have to set up your linker yourself (or patch clang). For example,

These instructions should only be used when you can’t install your ABI library.

Normally you must link libc++ against a ABI shared library that the
linker can find. If you want to build and test libc++ against an ABI
library not in the linker’s path you needq to set
-DLIBCXX_CXX_ABI_LIBRARY_PATH=/path/to/abi/lib when configuring CMake.