File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,15 +91,25 @@ include(CheckSourceCompiles)
9191
9292#thread_local
9393set (CMAKE_C_STANDARD 11)
94+ if (HAVE_THREADS_H)
9495check_source_compiles (C [[
9596 #include "threads.h"
96- thread_local int a=0;
97+ thread_local int a=0;
9798 int main()
9899 {
99100 return 0;
100101 }
101102]] HAVE_C_THREAD_LOCAL )
102-
103+ else ()
104+ check_source_compiles (C [[
105+ #include "stdlib.h"
106+ thread_local int a=0;
107+ int main()
108+ {
109+ return 0;
110+ }
111+ ]] HAVE_C_THREAD_LOCAL )
112+ endif ()
103113if (HAVE_C_THREAD_LOCAL)
104114target_compile_definitions (HBox PUBLIC HAVE_C_THREAD_LOCAL=1 )
105115endif ()
@@ -121,6 +131,7 @@ endif()
121131
122132#_Atomic
123133set (CMAKE_C_STANDARD 11)
134+ if (HAVE_STDATOMIC_H)
124135check_source_compiles (C [[
125136 #include "stdatomic.h"
126137 _Atomic int a=0;
@@ -129,6 +140,16 @@ check_source_compiles(C [[
129140 return 0;
130141 }
131142]] HAVE_C_ATOMIC )
143+ else ()
144+ check_source_compiles (C [[
145+ #include "stdlib.h"
146+ _Atomic int a=0;
147+ int main()
148+ {
149+ return 0;
150+ }
151+ ]] HAVE_C_ATOMIC )
152+ endif ()
132153
133154if (HAVE_C_ATOMIC)
134155target_compile_definitions (HBox PUBLIC HAVE_C_ATOMIC=1 )
You can’t perform that action at this time.
0 commit comments