From 958695276a6e8cc945f30115e9c9c1d575d24b76 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Thu, 20 Sep 2018 14:00:59 +0200 Subject: [PATCH] Fix THREADLOCAL definition Fixes #216 --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f34bd5d3..542d1a29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,7 +138,7 @@ if (NOT DEFINED HAVE_FPCLASSIFY) endif () option (WITH_THREADLOCAL "check thread local keyword" ON) -if (WITH_THREADLOCAL AND NOT DEFINED HAVE_THREAD_LOCAL_STORAGE) +if (WITH_THREADLOCAL AND NOT DEFINED THREADLOCAL) foreach (_THREADLOCAL_KEY "__thread" "__declspec(thread)") unset (HAVE_THREAD_LOCAL_STORAGE CACHE) check_c_source_compiles(" @@ -147,12 +147,13 @@ if (WITH_THREADLOCAL AND NOT DEFINED HAVE_THREAD_LOCAL_STORAGE) int main(void) { return 0; }" HAVE_THREAD_LOCAL_STORAGE) - if (${HAVE_THREAD_LOCAL_STORAGE}) - set (THREADLOCAL ${_THREADLOCAL_KEY}) + if (HAVE_THREAD_LOCAL_STORAGE) + set (THREADLOCAL ${_THREADLOCAL_KEY} CACHE STRING "Thread local keyword") endif () endforeach() endif () + if (NLOPT_CXX OR NLOPT_PYTHON OR NLOPT_GUILE OR NLOPT_OCTAVE) check_cxx_symbol_exists (__cplusplus ciso646 SYSTEM_HAS_CXX) if (SYSTEM_HAS_CXX)