From ab455ebafd55653f87168d9e6c32cfc15403a973 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 6 Apr 2014 10:10:54 +0200 Subject: [PATCH] Features: Add cxx_thread_local. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 1 + Source/cmMakefile.cxx | 1 + Tests/CompileFeatures/cxx_thread_local.cpp | 2 ++ 4 files changed, 9 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_thread_local.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index f41936601..b544d7e19 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -147,6 +147,11 @@ The features known to this version of CMake are: .. _N2347: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf +``cxx_thread_local`` + Thread-local variables, as defined in N2659_. + + .. _N2659: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm + ``cxx_trailing_return_types`` Automatic function return type, as defined in N2541_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 73cd145ce..1f56aceb7 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -10,6 +10,7 @@ set(_cmake_feature_test_cxx_alignas "${GNU48_CXX11}") set(_cmake_feature_test_cxx_alignof "${GNU48_CXX11}") set(_cmake_feature_test_cxx_attributes "${GNU48_CXX11}") set(_cmake_feature_test_cxx_inheriting_constructors "${GNU48_CXX11}") +set(_cmake_feature_test_cxx_thread_local "${GNU48_CXX11}") # TODO: Should be supported by GNU 4.7 set(GNU47_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_alias_templates "${GNU47_CXX11}") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2f2747d78..6d2a5766b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -69,6 +69,7 @@ F(cxx_rvalue_references) \ F(cxx_static_assert) \ F(cxx_strong_enums) \ + F(cxx_thread_local) \ F(cxx_trailing_return_types) \ F(cxx_unicode_literals) \ F(cxx_uniform_initialization) \ diff --git a/Tests/CompileFeatures/cxx_thread_local.cpp b/Tests/CompileFeatures/cxx_thread_local.cpp new file mode 100644 index 000000000..1fb27e241 --- /dev/null +++ b/Tests/CompileFeatures/cxx_thread_local.cpp @@ -0,0 +1,2 @@ + +thread_local unsigned int rage = 1;