CMakeLists: Add -fexperimental-library to allow use of std::jthread with libc++ 18.

This commit is contained in:
Jordan Woyak committed 2026-10-09 14:52:24 -05:00
1 parent 5bcd55eef5
commit 0f56e58742
1 file changed
+13
+13
View File
@@ -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)