forked from BrianGladman/pthreads
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
63 lines (52 loc) · 1.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
CMAKE_MINIMUM_REQUIRED (VERSION 2.6 FATAL_ERROR)
PROJECT (pthreads-w32)
####################
# Pthreads version
####################
SET (PTHREADS_W32_VERSION_MAJOR 2)
SET (PTHREADS_W32_VERSION_MINOR 9)
SET (PTHREADS_W32_VERSION_PATCH 1)
SET (PTHREADS_W32_VERSION "${PTHREADS_W32_VERSION_MAJOR}.${PTHREADS_W32_VERSION_MINOR}")
SET (PTHREADS_W32_VERSION_FULL "${PTHREADS_W32_VERSION}.${PTHREADS_W32_VERSION_PATCH}")
##########################
# Pthreads configuration
##########################
# Standard CMake option for building libraries shared or static by default.
OPTION (BUILD_SHARED_LIBS "Build with shared libraries." OFF)
# Additional include directories
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR})
# Preprocessor definitions
ADD_DEFINITIONS (-D__PTW32_CONFIG_H)
ADD_DEFINITIONS (-D__CLEANUP_C)
IF (BUILD_SHARED_LIBS)
ADD_DEFINITIONS (-DPTW32_BUILD)
ELSE (BUILD_SHARED_LIBS)
ADD_DEFINITIONS (-DPTW32_STATIC_LIB)
ENDIF (BUILD_SHARED_LIBS)
SET (RESOURCE_COMPILE_DEFINITIONS "PTW32_RC_MSC")
IF (CMAKE_CL_64)
SET (RESOURCE_COMPILE_DEFINITIONS "${RESOURCE_COMPILE_DEFINITIONS};PTW32_ARCHx64")
ELSE (CMAKE_CL_64)
SET (RESOURCE_COMPILE_DEFINITIONS "${RESOURCE_COMPILE_DEFINITIONS};PTW32_ARCHx86")
ENDIF (CMAKE_CL_64)
SET_PROPERTY (SOURCE version.rc PROPERTY COMPILE_DEFINITIONS ${RESOURCE_COMPILE_DEFINITIONS})
SET (SOURCE_FILES
implement.h
pthread.c
pthread.h
sched.h
semaphore.h
#version.rc
)
ADD_LIBRARY (pthreads ${SOURCE_FILES})
# Workaround for issue 0011240: VS 2010 Win64 does not correctly set /MACHINE:x64
# in the solution project files.
IF (CMAKE_CL_64)
SET_TARGET_PROPERTIES (pthreads PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
ENDIF (CMAKE_CL_64)
# Installation
INSTALL (TARGETS pthreads
RUNTIME DESTINATION bin COMPONENT Runtime
LIBRARY DESTINATION lib COMPONENT Runtime
ARCHIVE DESTINATION lib COMPONENT Development
)