[libcxx-commits] [libcxx] [libcxxabi] [libc++] Introduce the notion of a minimum header version (PR #166074)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 17 07:43:50 PST 2025


================
@@ -321,6 +321,7 @@ add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
 # libcxxabi needs to, for various reasons, include the libcpp headers as if
 # it is being built as part of libcxx.
 add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
+add_definitions(-D_LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION=${LIBCXX_AVAILABILITY_MINIMUM_HEADER_VERSION})
----------------
ldionne wrote:

This doesn't work because `LIBCXX_AVAILABILITY_MINIMUM_HEADER_VERSION` isn't known at this point (we process libc++abi before we process libc++ in `runtimes/CMakeLists.txt`).

Instead, we have two choices:
1. Hoist the option into `runtimes/cmake/Modules/CommonOptions.cmake` and name it `RUNTIMES_AVAILABILITY_MINIMUM_HEADER_VERSION`, then use that from both libc++ and libc++abi (and elsewhere if needed). We have a desire to canonicalize some of the options that are currently duplicated across runtimes (e.g. `LIBCXX_ENABLE_EXCEPTIONS`, etc), so this could set the precedent for doing that.
2. Duplicate the setting into `LIBCXXABI_AVAILABILITY_MINIMUM_HEADER_VERSION`. I think this is the path of least resistance for now.

I think I would do (2) for now.

https://github.com/llvm/llvm-project/pull/166074


More information about the libcxx-commits mailing list