1# dethread cmake file 2add_definitions(-D_XOPEN_SOURCE=600) 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/deSemaphoreMach.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 if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") 42 add_definitions(-D__BSD_VISIBLE) 43 add_definitions(-D_XOPEN_SOURCE=600) 44 endif () 45 add_definitions(-D_GNU_SOURCE) 46 47 set(DETHREAD_LIBS ${DETHREAD_LIBS} pthread) 48endif () 49 50if (DE_OS_IS_ANDROID OR DE_OS_IS_OSX OR DE_OS_IS_IOS OR DE_OS_IS_QNX OR DE_OS_IS_FUCHSIA) 51 add_definitions(-D_XOPEN_SOURCE=600) 52endif () 53 54add_library(dethread STATIC ${DETHREAD_SRCS}) 55target_link_libraries(dethread ${DETHREAD_LIBS}) 56 57set(DETHREAD_STANDALONE_TEST ON CACHE STRING "Build standalone binary for testing dethread.") 58 59if (DETHREAD_STANDALONE_TEST AND (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX)) 60 add_executable(dethread_test standalone_test.c) 61 target_link_libraries(dethread_test dethread debase) 62endif () 63