I’m setting up a Clang toolchain build on Windows. We need to include runtimes for several targets including Windows, Linux and Fuchsia. In the case of Windows and Linux we only want to provide static libc++. In the case of Fuchsia we want to provide both static and shared.

This leads to an issue: because of this condition https://github.com/llvm/llvm-project/blob/9a48411f35a122ac8755a8453887b919c77daf3f/libcxx/CMakeLists.txt#L861, _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS is set to ON for Windows, but to OFF on Linux and Fuchsia. Since this definition is a part of __config_site.in https://github.com/llvm/llvm-project/blob/9a48411f35a122ac8755a8453887b919c77daf3f/libcxx/include/__config_site.in#L28 we cannot use a single __config that would be usable for all targets which breaks the build of our toolchain.

Does anyone know why we have that condition? Why is it only restricted to Windows? It’s not clear to me why libc++ on Windows should be different from other platforms. Users that want to disable visibility annotations can always set _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS in their build which is what projects like Chromium and Fuchsia already do.