diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2026-10-09 14:51:43 -0500 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2026-10-09 14:52:24 -0500 |
| commit | 0f56e58742a64a993e4f2f7b34cbafccb613ebcd (patch) | |
| tree | 61dccbad521b07e333754299295f6f4d1d9e696b | |
| parent | 5bcd55eef5323db2d83bd181f128409edc1d902e (diff) | |
CMakeLists: Add -fexperimental-library to allow use of std::jthread with libc++ 18.
| -rw-r--r-- | Source/CMakeLists.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 140abb02d7..cdfabd36c8 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -19,6 +19,19 @@ if (NOT MSVC) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) + + # std::jthread is guarded behind -fexperimental-library prior to libc++ version 20 + check_cxx_source_compiles([[ + #include <version> + #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 200000 + #error libc++ version < 20 + #endif + int main() {} + ]] IS_JTHREAD_STABLE) + + if(NOT IS_JTHREAD_STABLE) + add_compile_options(-fexperimental-library) + endif() endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) |
