root/OpenSceneGraph/trunk/src/OpenThreads/CMakeLists.txt @ 11076

Revision 11076, 3.4 kB (checked in by robert, 4 years ago)

Updated version number of OpenThreads? to reflect recent changes

Line 
1# This is mainly for Windows declspec, but other platforms know
2# what to do with it.
3ADD_DEFINITIONS(-DOPENTHREADS_EXPORTS)
4
5SET(OPENTHREADS_MAJOR_VERSION 2)
6SET(OPENTHREADS_MINOR_VERSION 5)
7SET(OPENTHREADS_PATCH_VERSION 0)
8SET(OPENTHREADS_SOVERSION 12)
9
10SET(OPENTHREADS_VERSION ${OPENTHREADS_MAJOR_VERSION}.${OPENTHREADS_MINOR_VERSION}.${OPENTHREADS_PATCH_VERSION})
11
12INCLUDE(CheckAtomicOps)
13
14# User Options
15OPTION(DYNAMIC_OPENTHREADS "Set to ON to build OpenThreads for dynamic linking.  Use OFF for static." ON)
16IF(DYNAMIC_OPENTHREADS)
17    SET(OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
18ELSE()
19    SET(OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
20    SET(OT_LIBRARY_STATIC 1)
21ENDIF()
22
23################################################################################
24# Set Config file
25
26SET(OPENTHREADS_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/OpenThreads/Config")
27CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/common/Config.in"
28               "${OPENTHREADS_CONFIG_HEADER}")
29
30
31################################################################################
32# Set Version Info resource file
33
34IF(MSVC)
35    SET(OPENTHREADS_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenThreadsVersionInfo.rc")
36    CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenThreadsVersionInfo.rc.in"
37                   "${OPENTHREADS_VERSIONINFO_RC}")
38ENDIF()
39
40
41# INSTALL_FILES(/include/OpenThreads/ FILES "${OPENTHREADS_CONFIG_HEADER}")
42
43################################################################################
44
45SET(HEADER_PATH ${OpenThreads_SOURCE_DIR}/include/OpenThreads)
46SET(OpenThreads_PUBLIC_HEADERS
47    ${HEADER_PATH}/Atomic
48    ${HEADER_PATH}/Barrier
49    ${HEADER_PATH}/Block
50    ${HEADER_PATH}/Condition
51    ${HEADER_PATH}/Exports
52    ${HEADER_PATH}/Mutex 
53    ${HEADER_PATH}/ReadWriteMutex 
54    ${HEADER_PATH}/ReentrantMutex 
55    ${HEADER_PATH}/ScopedLock 
56    ${HEADER_PATH}/Thread
57    ${HEADER_PATH}/Version
58    ${OPENTHREADS_CONFIG_HEADER}
59)
60
61# Use our modified version of FindThreads.cmake which has Sproc hacks.
62FIND_PACKAGE(Threads)
63
64# Do we have sproc?
65IF(CMAKE_SYSTEM MATCHES IRIX)
66    IF(CMAKE_USE_SPROC_INIT)
67        # In this case, only Sproc exists, so no option.
68        SET(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS 1)
69    ELSE()
70        IF(CMAKE_HAVE_SPROC_H)
71            OPTION(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS "Set to ON to build OpenThreads against sproc instead of pthreads" OFF)
72        ENDIF()
73    ENDIF()
74ENDIF(CMAKE_SYSTEM MATCHES IRIX)
75
76# Maybe we should be using the FindThreads.cmake module?
77IF(WIN32)
78    # So I think Cygwin wants to use pthreads
79    IF(CYGWIN)
80        SUBDIRS(pthreads)
81    ELSE()
82        # Everybody else including Msys should probably go here
83        SUBDIRS(win32)
84        # examples)
85    ENDIF()
86ELSE()
87    IF(UNIX)
88        IF(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS)
89            SUBDIRS(sproc)
90        ELSE()
91            SUBDIRS(pthreads)
92        ENDIF()
93    ELSE()
94        MESSAGE("Sorry, OpenThreads may not support your platform")
95    ENDIF()
96ENDIF()
97
98# Make sure everyone can find Config
99INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include)
100
101# Generate pkg-config configuration file
102
103CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/openthreads.pc.in
104        ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openthreads.pc
105    @ONLY
106    )
107
108INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openthreads.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig  COMPONENT libopenthreads-dev)
Note: See TracBrowser for help on using the browser.