[libcxx-commits] [libcxx] [libc++] Build the library with C++26 (PR #181021)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 23 08:48:26 PST 2026
https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/181021
>From ebcbb0b89d9ba5e4efa84c62b8ae8764f2f4a2f4 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 11 Feb 2026 16:25:04 -0500
Subject: [PATCH 1/2] [libc++] Build the library with C++26
All supported compilers support C++26. This allows simplifying some
of the upcoming <text_encoding> implementation.
---
libcxx/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 0ac582cb561a8..8f3f08fb60de2 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -504,9 +504,9 @@ remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
# Required flags ==============================================================
function(cxx_add_basic_build_flags target)
- # Use C++23 for all targets.
+ # Use C++26 for all targets.
set_target_properties(${target} PROPERTIES
- CXX_STANDARD 23
+ CXX_STANDARD 26
CXX_STANDARD_REQUIRED OFF # TODO: Make this REQUIRED once we don't need to accommodate the LLVM documentation builders using an ancient CMake
CXX_EXTENSIONS NO)
>From 22d14f2e018b8b0d4af1859532b4f57cbda8918b Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 23 Feb 2026 11:48:13 -0500
Subject: [PATCH 2/2] Don't use set_target_properties to remove dependency on
recent CMake
---
libcxx/CMakeLists.txt | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 8f3f08fb60de2..dcb393b380a7c 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -504,11 +504,9 @@ remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
# Required flags ==============================================================
function(cxx_add_basic_build_flags target)
- # Use C++26 for all targets.
- set_target_properties(${target} PROPERTIES
- CXX_STANDARD 26
- CXX_STANDARD_REQUIRED OFF # TODO: Make this REQUIRED once we don't need to accommodate the LLVM documentation builders using an ancient CMake
- CXX_EXTENSIONS NO)
+ # Use C++26 for all targets. Note that we don't use CXX_STANDARD or cxx_std_foo
+ # since that requires a newer CMake than is available.
+ target_compile_options(${target} PRIVATE -std=c++26)
# When building the dylib, don't warn for unavailable aligned allocation
# functions based on the deployment target -- they are always available
More information about the libcxx-commits
mailing list