Skip to content

Commit

Permalink
Fix THREADLOCAL definition
Browse files Browse the repository at this point in the history
Fixes #216
  • Loading branch information
jschueller committed Sep 20, 2018
1 parent 8041dc9 commit 9586952
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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("
Expand All @@ -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)
Expand Down

0 comments on commit 9586952

Please sign in to comment.