Browse Source

Features: Add cxx_thread_local.

Stephen Kelly 11 năm trước cách đây
mục cha
commit
ab455ebafd

+ 5 - 0
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_.
 

+ 1 - 0
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}")

+ 1 - 0
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) \

+ 2 - 0
Tests/CompileFeatures/cxx_thread_local.cpp

@@ -0,0 +1,2 @@
+
+thread_local unsigned int rage = 1;