]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/tools/vcpkg/ports/pthreads/vcpkg-cmake-wrapper.cmake
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / tools / vcpkg / ports / pthreads / vcpkg-cmake-wrapper.cmake
CommitLineData
1e59de90
TL
1#.rst:
2# PThreads4W config wrap for vcpkg
3# ------------
4#
5# Find the PThread4W includes and library.
6#
7# Result Variables
8# ^^^^^^^^^^^^^^^^
9#
10# This script defines the following variables:
11#
12# ``PThreads4W_FOUND``
13# True if PThreads4W library found
14#
15# ``PThreads4W_VERSION``
16# Containing the PThreads4W version tag (manually defined)
17#
18# ``PThreads4W_INCLUDE_DIR``
19# Location of PThreads4W headers
20#
21# ``PThreads4W_LIBRARY``
22# List of libraries to link with when using PThreads4W (no exception handling)
23#
24# ``PThreads4W_CXXEXC_LIBRARY``
25# List of libraries to link with when using PThreads4W (C++ exception handling)
26#
27# ``PThreads4W_STRUCTEXC_LIBRARY``
28# List of libraries to link with when using PThreads4W (struct exception handling)
29#
30# Result Targets
31# ^^^^^^^^^^^^^^^^
32#
33# This script defines the following targets:
34#
35# ``PThreads4W::PThreads4W``
36# Target to use PThreads4W (no exception handling)
37#
38# ``PThreads4W::PThreads4W_CXXEXC``
39# Target to use PThreads4W (C++ exception handling)
40#
41# ``PThreads4W::PThreads4W_STRUCTEXC``
42# Target to use PThreads4W (struct exception handling)
43#
44
45include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
46include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
47
48if(NOT PThreads4W_INCLUDE_DIR)
49 find_path(PThreads4W_INCLUDE_DIR NAMES pthread.h)
50endif()
51
52set(PThreads4W_MAJOR_VERSION 3)
53set(PThreads4W_MINOR_VERSION 0)
54set(PThreads4W_PATCH_VERSION 0)
55set(PThreads4W_VERSION "${PThreads4W_MAJOR_VERSION}.${PThreads4W_MINOR_VERSION}.${PThreads4W_PATCH_VERSION}")
56
57# Allow libraries to be set manually
58if(NOT PThreads4W_LIBRARY)
59 find_library(PThreads4W_LIBRARY_RELEASE NAMES pthreadVC${PThreads4W_MAJOR_VERSION})
60 find_library(PThreads4W_LIBRARY_DEBUG NAMES pthreadVC${PThreads4W_MAJOR_VERSION}d)
61 select_library_configurations(PThreads4W)
62endif()
63if(NOT PThreads4W_CXXEXC_LIBRARY)
64 find_library(PThreads4W_CXXEXC_LIBRARY_RELEASE NAMES pthreadVCE${PThreads4W_MAJOR_VERSION})
65 find_library(PThreads4W_CXXEXC_LIBRARY_DEBUG NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}d)
66 select_library_configurations(PThreads4W_CXXEXC)
67endif()
68if(NOT PThreads4W_STRUCTEXC_LIBRARY)
69 find_library(PThreads4W_STRUCTEXC_LIBRARY_RELEASE NAMES pthreadVSE${PThreads4W_MAJOR_VERSION})
70 find_library(PThreads4W_STRUCTEXC_LIBRARY_DEBUG NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d)
71 select_library_configurations(PThreads4W_STRUCTEXC)
72endif()
73
74find_package_handle_standard_args(PThreads4W DEFAULT_MSG PThreads4W_LIBRARY PThreads4W_CXXEXC_LIBRARY PThreads4W_STRUCTEXC_LIBRARY PThreads4W_INCLUDE_DIR)
75mark_as_advanced(PThreads4W_INCLUDE_DIR PThreads4W_LIBRARY PThreads4W_CXXEXC_LIBRARY PThreads4W_STRUCTEXC_LIBRARY)
76
77set(PThreads4W_DLL_DIR ${PThreads4W_INCLUDE_DIR})
78list(TRANSFORM PThreads4W_DLL_DIR APPEND "/../bin")
79message(STATUS "PThreads4W_DLL_DIR: ${PThreads4W_DLL_DIR}")
80
81find_file(PThreads4W_LIBRARY_RELEASE_DLL NAMES pthreadVC${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR})
82find_file(PThreads4W_LIBRARY_DEBUG_DLL NAMES pthreadVC${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DLL_DIR})
83find_file(PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR})
84find_file(PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL NAMES pthreadVCE${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DLL_DIR})
85find_file(PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}.dll PATHS ${PThreads4W_DLL_DIR})
86find_file(PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL NAMES pthreadVSE${PThreads4W_MAJOR_VERSION}d.dll PATHS ${PThreads4W_DLL_DIR})
87
88#Compatibility definitions, deprecated
89set(PTHREAD_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "")
90set(PTHREADS_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "")
91set(PThreads_windows_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR} CACHE PATH "")
92set(PTHREAD_LIBRARIES ${PThreads4W_LIBRARY} CACHE STRING "")
93set(PTHREADS_LIBRARIES ${PThreads4W_LIBRARY} CACHE STRING "")
94set(PTHREAD_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "")
95set(PTHREADS_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "")
96set(LIBPTHREAD ${PThreads4W_LIBRARY} CACHE STRING "")
97set(LIBPTHREADS ${PThreads4W_LIBRARY} CACHE STRING "")
98set(PThreads_windows_LIBRARY ${PThreads4W_LIBRARY} CACHE STRING "")
99set(PThreads_VERSION "${PThreads4W_VERSION}")
100if(PThreads4W_FOUND)
101 set(PThreads_windows_FOUND TRUE)
102endif()
103
104#TARGETS
105if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W_CXXEXC )
106 if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL}" )
107 add_library( PThreads4W::PThreads4W_CXXEXC SHARED IMPORTED )
108 set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
109 IMPORTED_LOCATION_RELEASE "${PThreads4W_CXXEXC_LIBRARY_RELEASE_DLL}"
110 IMPORTED_IMPLIB "${PThreads4W_CXXEXC_LIBRARY_RELEASE}"
111 INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
112 IMPORTED_CONFIGURATIONS Release
113 IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
114 if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL}" )
115 set_property( TARGET PThreads4W::PThreads4W_CXXEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
116 set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
117 IMPORTED_LOCATION_DEBUG "${PThreads4W_CXXEXC_LIBRARY_DEBUG_DLL}"
118 IMPORTED_IMPLIB_DEBUG "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
119 endif()
120 else()
121 add_library( PThreads4W::PThreads4W_CXXEXC UNKNOWN IMPORTED )
122 set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
123 IMPORTED_LOCATION_RELEASE "${PThreads4W_CXXEXC_LIBRARY_RELEASE}"
124 INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
125 IMPORTED_CONFIGURATIONS Release
126 IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
127 if( EXISTS "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
128 set_property( TARGET PThreads4W::PThreads4W_CXXEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
129 set_target_properties( PThreads4W::PThreads4W_CXXEXC PROPERTIES
130 IMPORTED_LOCATION_DEBUG "${PThreads4W_CXXEXC_LIBRARY_DEBUG}" )
131 endif()
132 endif()
133endif()
134
135if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W_STRUCTEXC )
136 if( EXISTS "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL}" )
137 add_library( PThreads4W::PThreads4W_STRUCTEXC SHARED IMPORTED )
138 set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
139 IMPORTED_LOCATION_RELEASE "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE_DLL}"
140 IMPORTED_IMPLIB "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE}"
141 INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
142 IMPORTED_CONFIGURATIONS Release
143 IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
144 if( EXISTS "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL}" )
145 set_property( TARGET PThreads4W::PThreads4W_STRUCTEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
146 set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
147 IMPORTED_LOCATION_DEBUG "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG_DLL}"
148 IMPORTED_IMPLIB_DEBUG "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
149 endif()
150 else()
151 add_library( PThreads4W::PThreads4W_STRUCTEXC UNKNOWN IMPORTED )
152 set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
153 IMPORTED_LOCATION_RELEASE "${PThreads4W_STRUCTEXC_LIBRARY_RELEASE}"
154 INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
155 IMPORTED_CONFIGURATIONS Release
156 IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
157 if( EXISTS "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
158 set_property( TARGET PThreads4W::PThreads4W_STRUCTEXC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
159 set_target_properties( PThreads4W::PThreads4W_STRUCTEXC PROPERTIES
160 IMPORTED_LOCATION_DEBUG "${PThreads4W_STRUCTEXC_LIBRARY_DEBUG}" )
161 endif()
162 endif()
163endif()
164
165if( PThreads4W_FOUND AND NOT TARGET PThreads4W::PThreads4W )
166 if( EXISTS "${PThreads4W_LIBRARY_RELEASE_DLL}" )
167 add_library( PThreads4W::PThreads4W SHARED IMPORTED )
168 set_target_properties( PThreads4W::PThreads4W PROPERTIES
169 IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE_DLL}"
170 IMPORTED_IMPLIB "${PThreads4W_LIBRARY_RELEASE}"
171 INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
172 IMPORTED_CONFIGURATIONS Release
173 IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
174 if( EXISTS "${PThreads4W_LIBRARY_DEBUG_DLL}" )
175 set_property( TARGET PThreads4W::PThreads4W APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
176 set_target_properties( PThreads4W::PThreads4W PROPERTIES
177 IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG_DLL}"
178 IMPORTED_IMPLIB_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
179 endif()
180 else()
181 add_library( PThreads4W::PThreads4W UNKNOWN IMPORTED )
182 set_target_properties( PThreads4W::PThreads4W PROPERTIES
183 IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE}"
184 INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
185 IMPORTED_CONFIGURATIONS Release
186 IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
187 if( EXISTS "${PThreads4W_LIBRARY_DEBUG}" )
188 set_property( TARGET PThreads4W::PThreads4W APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
189 set_target_properties( PThreads4W::PThreads4W PROPERTIES
190 IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
191 endif()
192 endif()
193endif()
194
195#Compatibility targets, deprecated
196if( PThreads4W_FOUND AND NOT TARGET PThreads_windows::PThreads_windows )
197 if( EXISTS "${PThreads4W_LIBRARY_RELEASE_DLL}" )
198 add_library( PThreads_windows::PThreads_windows SHARED IMPORTED )
199 set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
200 IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE_DLL}"
201 IMPORTED_IMPLIB "${PThreads4W_LIBRARY_RELEASE}"
202 INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
203 IMPORTED_CONFIGURATIONS Release
204 IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
205 if( EXISTS "${PThreads4W_LIBRARY_DEBUG_DLL}" )
206 set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
207 set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
208 IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG_DLL}"
209 IMPORTED_IMPLIB_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
210 endif()
211 else()
212 add_library( PThreads_windows::PThreads_windows UNKNOWN IMPORTED )
213 set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
214 IMPORTED_LOCATION_RELEASE "${PThreads4W_LIBRARY_RELEASE}"
215 INTERFACE_INCLUDE_DIRECTORIES "${PThreads4W_INCLUDE_DIR}"
216 IMPORTED_CONFIGURATIONS Release
217 IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
218 if( EXISTS "${PThreads4W_LIBRARY_DEBUG}" )
219 set_property( TARGET PThreads_windows::PThreads_windows APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
220 set_target_properties( PThreads_windows::PThreads_windows PROPERTIES
221 IMPORTED_LOCATION_DEBUG "${PThreads4W_LIBRARY_DEBUG}" )
222 endif()
223 endif()
224endif()