1
# WinPR: Windows Portable Runtime
2
# libwinpr-synch cmake build script
4
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
18
set(MODULE_NAME "winpr-synch")
19
set(MODULE_PREFIX "WINPR_SYNCH")
21
INCLUDE (CheckLibraryExists)
22
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
23
check_library_exists(pthread pthread_tryjoin_np "" HAVE_PTHREAD_GNU_EXT)
24
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
26
if(HAVE_PTHREAD_GNU_EXT)
27
add_definitions(-D_GNU_SOURCE -DHAVE_PTHREAD_GNU_EXT)
28
endif(HAVE_PTHREAD_GNU_EXT)
30
include_directories(../thread)
32
set(${MODULE_PREFIX}_SRCS
48
add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT"
49
MONOLITHIC ${MONOLITHIC_BUILD}
50
SOURCES ${${MODULE_PREFIX}_SRCS})
52
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
54
set(${MODULE_PREFIX}_LIBS
55
${CMAKE_THREAD_LIBS_INIT}
58
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
59
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} rt)
62
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
63
MONOLITHIC ${MONOLITHIC_BUILD} INTERNAL
65
MODULES winpr-handle winpr-interlocked winpr-thread)
68
set(WINPR_LIBS ${WINPR_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE)
70
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
71
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
74
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")
77
add_subdirectory(test)