summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-01-08 20:04:25 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-01-08 20:04:25 (GMT)
commit7ecbade8877522d9d565bcb2216f71426873f564 (patch)
treeb2ef8adfdd551fea4e83b31e01ad3bfddaf0dd20 /Modules
parent44b2dcb2e0c945339947c2e71b32f6da2fc4f610 (diff)
parent998e9c10943ef361785e6f15cab1fa61172b1c24 (diff)
downloadCMake-7ecbade8877522d9d565bcb2216f71426873f564.zip
CMake-7ecbade8877522d9d565bcb2216f71426873f564.tar.gz
CMake-7ecbade8877522d9d565bcb2216f71426873f564.tar.bz2
Merge topic 'WCDH-thread_local-portability'
998e9c10 WCDH: Add feature portability for thread_local.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 36b9706..d61358f 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -194,6 +194,7 @@
# ``cxx_static_assert`` ``<PREFIX>_STATIC_ASSERT_MSG`` ``static_assert``
# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED`` ``[[deprecated]]``
# ``cxx_attribute_deprecated`` ``<PREFIX>_DEPRECATED_MSG`` ``[[deprecated]]``
+# ``cxx_thread_local`` ``<PREFIX>_THREAD_LOCAL`` ``thread_local``
# ============================= ================================ =====================
#
# A use-case which arises with such deprecation macros is the deprecation
@@ -573,6 +574,20 @@ function(write_compiler_detection_header
# endif
\n")
endif()
+ if (feature STREQUAL cxx_thread_local)
+ set(def_value "${prefix_arg}_THREAD_LOCAL")
+ set(file_content "${file_content}
+# if ${def_name}
+# define ${def_value} thread_local
+# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang
+# define ${def_value} __thread
+# elif ${prefix_arg}_COMPILER_IS_MSVC
+# define ${def_value} __declspec(thread)
+# else
+// ${def_value} not defined for this configuration.
+# endif
+\n")
+ endif()
if (feature STREQUAL cxx_attribute_deprecated)
set(def_name ${prefix_arg}_${feature_PP})
set(def_value "${prefix_arg}_DEPRECATED")