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