From 2c161e887cb5aeb6e2e3d4d0871a7380403e5e09 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Sun, 11 May 2025 16:21:52 +0200 Subject: (C++ modules support) default cxx11abi to true when gcc version is >= 15 --- xmake/rules/c++/modules/gcc/support.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'xmake/rules/c++/modules/gcc/support.lua') diff --git a/xmake/rules/c++/modules/gcc/support.lua b/xmake/rules/c++/modules/gcc/support.lua index bc924f35c..e6f8591a0 100644 --- a/xmake/rules/c++/modules/gcc/support.lua +++ b/xmake/rules/c++/modules/gcc/support.lua @@ -61,6 +61,13 @@ function load(target) -- https://github.com/xmake-io/xmake/issues/3855 local cxx11abi = target:policy("build.c++.modules.gcc.cxx11abi") or target:policy("build.c++.gcc.modules.cxx11abi") + if cxx11abi == nil then + -- enable cxx11abi on GCC >= 15 as it is required for C++23 module + local gcc_version = get_gcc_version(target) + if gcc_version and semver.compare(gcc_version, "15") > 0 then + cxx11abi = true + end + end if cxx11abi then target:add("cxxflags", "-D_GLIBCXX_USE_CXX11_ABI=1") else -- cgit v1.3.1