1# dethread cmake file
2
3if (NOT DE_DEFS)
4	message(FATAL_ERROR "Include Defs.cmake")
5endif ()
6
7set(DETHREAD_SRCS
8	deAtomic.c
9	deAtomic.h
10	deMutex.h
11	deSemaphore.h
12	deSingleton.c
13	deSingleton.h
14	deThread.h
15	deThreadLocal.h
16	deThreadTest.c
17	deThreadTest.h
18	win32/deMutexWin32.c
19	win32/deSemaphoreWin32.c
20	win32/deThreadWin32.c
21	win32/deThreadLocalWin32.c
22	unix/deMutexUnix.c
23	unix/deNamedSemaphoreUnix.c
24	unix/deSemaphoreUnix.c
25	unix/deThreadUnix.c
26	unix/deThreadLocalUnix.c
27	)
28
29set(DETHREAD_LIBS
30	debase
31	depool
32	)
33
34include_directories(
35	../debase
36	../depool
37	${CMAKE_CURRENT_SOURCE_DIR}
38	)
39
40if (DE_OS_IS_UNIX)
41	add_definitions(-D_GNU_SOURCE)
42	set(DETHREAD_LIBS ${DETHREAD_LIBS} pthread)
43endif ()
44
45if (DE_OS_IS_ANDROID OR DE_OS_IS_OSX OR DE_OS_IS_IOS OR DE_OS_IS_QNX)
46	add_definitions(-D_XOPEN_SOURCE=600)
47endif ()
48
49add_library(dethread STATIC ${DETHREAD_SRCS})
50target_link_libraries(dethread ${DETHREAD_LIBS})
51
52set(DETHREAD_STANDALONE_TEST ON CACHE STRING "Build standalone binary for testing dethread.")
53
54if (DETHREAD_STANDALONE_TEST AND (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX))
55	add_executable(dethread_test standalone_test.c)
56	target_link_libraries(dethread_test dethread debase)
57endif ()
58