1add_header_library(
2  mutex_common
3  HDRS
4    mutex_common.h
5)
6
7add_header_library(
8  thread_attrib
9  HDRS
10    thread_attrib.h
11  DEPENDS
12    libc.src.__support.common
13    libc.src.__support.CPP.atomic
14)
15
16if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
17  add_subdirectory(${LIBC_TARGET_OS})
18endif()
19
20if(TARGET libc.src.__support.threads.${LIBC_TARGET_OS}.mutex)
21  add_header_library(
22    mutex
23    HDRS
24      mutex.h
25    DEPENDS
26      .${LIBC_TARGET_OS}.mutex
27  )
28endif()
29
30if(TARGET libc.src.__support.threads.${LIBC_TARGET_OS}.thread)
31  add_object_library(
32    thread
33    HDRS
34      thread.h
35    SRCS
36      ${LIBC_TARGET_OS}/thread.cpp
37    DEPENDS
38      .thread_attrib
39    COMPILE_OPTIONS
40      -O3
41      -fno-omit-frame-pointer # This allows us to sniff out the thread args from
42                              # the new thread's stack reliably.
43  )
44endif()
45