C++23 support for target


I want to build cross platform package which heavily use c++23 features, but can't build it with SPM.
With CMake it works fine for Linux/OSX/iOS/Win with
But SPM supports CXXLanguageStandard only up to c++20.
I tried to remove CXXLanguageStandard and add flags
But compiler complains and allow to specify up to
Which unfortunately can't help to compile.

I don't have intentions to expose C++23 features to Swift level, just to use internally in c++ target.

Do you have any suggestions to organize C++23 code in cross platform Swift package ?

C23 and C++23 are supported, via the C2x and C++2b aliases.

// swift-tools-version: 5.6

import PackageDescription

let package = Package(
  name: "…",
  products: […],
  dependencies: […],
  targets: […],
  // Use the C23 and C++23 modes,
  // for all targets in this package.
  cLanguageStandard: .c2x,    // or `.gnu2x`
  cxxLanguageStandard: .cxx2b // or `.gnucxx2b`

SwiftPM doesn't support mixed-language targets yet. SE-0403 was "returned for revision" last year.