File: FindomniORB4.cmake

package info (click to toggle)
tango 10.0.2%2Bdfsg1-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 89,480 kB
  • sloc: cpp: 201,245; sh: 1,645; python: 953; java: 800; perl: 467; javascript: 447; xml: 325; makefile: 269; sql: 72; ruby: 24
file content (336 lines) | stat: -rw-r--r-- 11,828 bytes parent folder | download | duplicates (2)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#[=======================================================================[.rst:
FindomniORB4
------------

Find the omniORB4 libraries

Components
^^^^^^^^^^

    ``COS4``
    Provides the ``omniORB4::COS4`` and ``omniORB4::COS4-static`` (if found) targets
    ``Dynamic4``
    Provides the ``omniORB4::Dynamic4`` and ``omniORB4::Dynamic4-static`` (if found) targets

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

    ``omniORB4::omniORB4``
    The omniORB4 library
    ``omniORB4::omniORB4-static``
    The omniORB4 static library
    ``omniORB4::thread``
    The omnithread library, linked to omniORB4::omniORB4
    ``omniORB4::thread-static``
    The omnithread static library, linked to omniORB4::omniORB4-static
    ``omniORB4::COS4``
    The COS library
    ``omniORB4::COS4-static``
    The COS static library
    ``omniORB4::Dynamic4``
    The Dynamic library
    ``omniORB4::Dynamic4-static``
    The Dynamic static library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

    ``omniORB4_thread_FOUND``
    True if the system has the COS4 library.
    ``omniORB4_COS4_FOUND``
    True if the system has the COS4 library.
    ``omniORB4_Dynamic4_FOUND``
    True if the system has the omniDynamic4 library.
    ``omniORB4_FOUND``
    True if that system has all the required components and
    the main omniORB4 library
    ``omniORB4_thread_IS_STATIC``
    True if ``omniORB4::thread`` is the same as ``omniORB4::thread-static``
    ``omniORB4_COS4_IS_STATIC``
    True if ``omniORB4::COS4`` is the same as ``omniORB4::COS4-static``
    ``omniORB4_Dynamic4_IS_STATIC``
    True if ``omniORB4::Dynamic4`` is the same as ``omniORB4::Dynamic4-static``
    ``omniORB4_IS_STATIC``
    True if ``omniORB4::omniORB4`` is the same as ``omniORB4::omniORB4-static``

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

    ``omniORB4_INCLUDE_DIR``
    The directory containing omniORB4/omniORB.h.
    ``omniORB4_LIBRARY_RELEASE``
    The path to the omniORB release library.
    ``omniORB4_LIBRARY_DEBUG``
    The path to the omniORB debug library.
    ``omniORB4_LIBRARY``
    The path to the omniORB library.
    ``omniORB4_static_LIBRARY_RELEASE``
    The path to the omniORB release static library.
    ``omniORB4_static_LIBRARY_DEBUG``
    The path to the omniORB debug static library.
    ``omniORB4_static_LIBRARY``
    The path to the omniORB static library.
    ``omniORB4_COS4_LIBRARY_RELEASE``
    The path to the omniORB release library.
    ``omniORB4_COS4_LIBRARY_DEBUG``
    The path to the omniORB debug library.
    ``omniORB4_COS4_LIBRARY``
    The path to the omniORB library.
    ``omniORB4_COS4_static_LIBRARY_RELEASE``
    The path to the omniORB release static library.
    ``omniORB4_COS4_static_LIBRARY_DEBUG``
    The path to the omniORB debug static library.
    ``omniORB4_COS4_static_LIBRARY``
    The path to the omniORB static library.
    ``omniORB4_Dynamic4_LIBRARY_RELEASE``
    The path to the omniORB release library.
    ``omniORB4_Dynamic4_LIBRARY_DEBUG``
    The path to the omniORB debug library.
    ``omniORB4_Dynamic4_LIBRARY``
    The path to the omniORB library.
    ``omniORB4_Dynamic4_static_LIBRARY_RELEASE``
    The path to the omniORB release static library.
    ``omniORB4_Dynamic4_static_LIBRARY_DEBUG``
    The path to the omniORB debug static library.
    ``omniORB4_Dynamic4_static_LIBRARY``
    The path to the omniORB static library.
    ``omniORB4_thread_LIBRARY_RELEASE``
    The path to the omniORB release library.
    ``omniORB4_thread_LIBRARY_DEBUG``
    The path to the omniORB debug library.
    ``omniORB4_thread_LIBRARY``
    The path to the omniORB library.
    ``omniORB4_thread_static_LIBRARY_RELEASE``
    The path to the omniORB release static library.
    ``omniORB4_thread_static_LIBRARY_DEBUG``
    The path to the omniORB debug static library.
    ``omniORB4_thread_static_LIBRARY``
    The path to the omniORB static library.

#]=======================================================================]

if (NOT DEFINED PKG_CONFIG_FOUND)
    find_package(PkgConfig QUIET)
endif()

if (PKG_CONFIG_FOUND)
    pkg_search_module(_omniORB4_PKG omniORB4 QUIET)
endif()

find_path(omniORB4_INCLUDE_DIR
    NAMES omniORB4/omniORB.h
    PATHS "${_omniORB4_PKG_INCLUDE_DIRS}"
)

include(SelectLibraryConfigurations)
function(_omniORB4_find_release_and_debug prefix release_names debug_names release_static_names debug_static_names)
    find_library(${prefix}_LIBRARY_RELEASE
        NAMES ${release_names}
        PATHS "${_omniORB4_PKG_LIBRARY_DIRS}"
    )

    find_library(${prefix}_LIBRARY_DEBUG
        NAMES ${debug_names}
        PATHS "${_omniORB4_PKG_LIBRARY_DIRS}"
    )

    find_library(${prefix}_static_LIBRARY_RELEASE
        NAMES ${release_static_names}
        PATHS "${_omniORB4_PKG_LIBRARY_DIRS}"
    )

    find_library(${prefix}_static_LIBRARY_DEBUG
        NAMES ${debug_static_names}
        PATHS "${_omniORB4_PKG_LIBRARY_DIRS}"
    )

    select_library_configurations(${prefix})
    select_library_configurations(${prefix}_static)

    if ("${${prefix}_LIBRARY}" STREQUAL "${${prefix}_static_LIBRARY}")
        set(${prefix}_IS_STATIC TRUE PARENT_SCOPE)
    endif()

    set(${prefix}_LIBRARY_RELEASE ${${prefix}_LIBRARY_RELEASE} PARENT_SCOPE)
    set(${prefix}_LIBRARY_DEBUG ${${prefix}_LIBRARY_DEBUG} PARENT_SCOPE)
    set(${prefix}_LIBRARY ${${prefix}_LIBRARY} PARENT_SCOPE)

    set(${prefix}_static_LIBRARY_RELEASE ${${prefix}_static_LIBRARY_RELEASE} PARENT_SCOPE)
    set(${prefix}_static_LIBRARY_DEBUG ${${prefix}_static_LIBRARY_DEBUG} PARENT_SCOPE)
    set(${prefix}_static_LIBRARY ${${prefix}_static_LIBRARY} PARENT_SCOPE)
endfunction()

function(_omniORB4_add_target prefix targetname)
    if (${prefix}_FOUND)
        if (NOT TARGET omniORB4::${targetname})
            add_library(omniORB4::${targetname} UNKNOWN IMPORTED)
        endif()
        if (${prefix}_LIBRARY_RELEASE)
            set_property(TARGET omniORB4::${targetname} APPEND PROPERTY
                IMPORTED_CONFIGURATIONS RELEASE
            )
            set_target_properties(omniORB4::${targetname} PROPERTIES
                IMPORTED_LOCATION_RELEASE "${${prefix}_LIBRARY_RELEASE}"
            )
        endif()
        if (${prefix}_LIBRARY_DEBUG)
            set_property(TARGET omniORB4::${targetname} APPEND PROPERTY
                IMPORTED_CONFIGURATIONS DEBUG
            )
            set_target_properties(omniORB4::${targetname} PROPERTIES
                IMPORTED_LOCATION_DEBUG "${${prefix}_LIBRARY_DEBUG}"
            )
        endif()
        set_target_properties(omniORB4::${targetname} PROPERTIES
            INTERFACE_INCLUDE_DIRECTORIES "${omniORB4_INCLUDE_DIR}"
            )
    endif()

    if (${prefix}_static_FOUND)
        if (NOT TARGET omniORB4::${targetname}-static)
            add_library(omniORB4::${targetname}-static UNKNOWN IMPORTED)
        endif()
        if (${prefix}_static_LIBRARY_RELEASE)
            set_property(TARGET omniORB4::${targetname}-static APPEND PROPERTY
                IMPORTED_CONFIGURATIONS RELEASE
            )
            set_target_properties(omniORB4::${targetname}-static PROPERTIES
                IMPORTED_LOCATION_RELEASE "${${prefix}_static_LIBRARY_RELEASE}"
            )
        endif()
        if (${prefix}_static_LIBRARY_DEBUG)
            set_property(TARGET omniORB4::${targetname}-static APPEND PROPERTY
                IMPORTED_CONFIGURATIONS DEBUG
            )
            set_target_properties(omniORB4::${targetname}-static PROPERTIES
                IMPORTED_LOCATION_DEBUG "${${prefix}_static_LIBRARY_DEBUG}"
            )
        endif()
        set_target_properties(omniORB4::${targetname}-static PROPERTIES
            INTERFACE_INCLUDE_DIRECTORIES "${omniORB4_INCLUDE_DIR}"
            )
    endif()
endfunction()

if (WIN32)
    _omniORB4_find_release_and_debug(omniORB4 omniORB4_rt omniORB4_rtd omniORB4 omniORB4d)
    _omniORB4_find_release_and_debug(omniORB4_thread omnithread_rt omnithread_rtd omnithread omnithreadd)
    _omniORB4_find_release_and_debug(omniORB4_COS4 COS4_rt COS4_rtd COS4 COS4d)
    _omniORB4_find_release_and_debug(omniORB4_Dynamic4 omniDynamic4_rt omniDynamic4_rtd omniDynamic4 omniDynamic4d)
else()
    _omniORB4_find_release_and_debug(omniORB4 omniORB4 omniORB4 libomniORB4.a libomniORB4.a)
    _omniORB4_find_release_and_debug(omniORB4_thread omnithread omnithread libomnithread.a libomnithread.a)
    _omniORB4_find_release_and_debug(omniORB4_COS4 COS4 COS4 libCOS4.a libCOS4.a)
    _omniORB4_find_release_and_debug(omniORB4_Dynamic4 omniDynamic4 omniDynamic4 libomniDynamic4.a libomniDynamci4.a)
endif()

if (omniORB4_thread_LIBRARY)
    set(omniORB4_thread_FOUND TRUE)
endif()

if (omniORB4_thread_static_LIBRARY)
    set(omniORB4_thread_static_FOUND TRUE)
endif()

if (omniORB4_COS4_LIBRARY)
    set(omniORB4_COS4_FOUND TRUE)
endif()

if (omniORB4_COS4_static_LIBRARY)
    set(omniORB4_COS4_static_FOUND TRUE)
endif()

if (omniORB4_Dynamic4_LIBRARY)
    set(omniORB4_Dynamic4_FOUND TRUE)
endif()

if (omniORB4_Dynamic4_static_LIBRARY)
    set(omniORB4_Dynamic4_static_FOUND TRUE)
endif()

if(omniORB4_static_LIBRARY AND omniORB4_thread_static_FOUND)
    set(omniORB4_static_FOUND TRUE)
endif()

if(NOT omniORB4_IS_STATIC AND omniORB4_thread_IS_STATIC)
    set(omniORB4_IS_STATIC TRUE)
endif()

# We require the thread component for the main omniORB4 library
list(APPEND omniORB4_FIND_COMPONENTS thread)
if (omniORB4_FIND_REQUIRED)
    set(omniORB4_FIND_REQUIRED_thread TRUE)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(omniORB4
    REQUIRED_VARS
        omniORB4_LIBRARY
        omniORB4_INCLUDE_DIR
    HANDLE_COMPONENTS
)

if (omniORB4_FOUND)
    mark_as_advanced(omniORB4_INCLUDE_DIR)
    mark_as_advanced(omniORB4_LIBRARY)
endif()

if (omniORB4_thread_FOUND)
    mark_as_advanced(omniORB4_thread_LIBRARY)
endif()

if (omniORB4_COS4_FOUND)
    mark_as_advanced(omniORB4_COS4_LIBRARY)
endif()

if (omniORB4_Dynamic4_FOUND)
    mark_as_advanced(omniORB4_Dynamic4_LIBRARY)
endif()

_omniORB4_add_target(omniORB4 omniORB4)
_omniORB4_add_target(omniORB4_thread thread)
_omniORB4_add_target(omniORB4_COS4 COS4)
_omniORB4_add_target(omniORB4_Dynamic4 Dynamic4)

if (TARGET omniORB4::omniORB4 AND TARGET omniORB4::thread)
    set_target_properties(omniORB4::omniORB4 PROPERTIES
        INTERFACE_LINK_LIBRARIES omniORB4::thread
        )
endif()

if (TARGET omniORB4::omniORB4-static AND TARGET omniORB4::thread-static)
    set_target_properties(omniORB4::omniORB4-static PROPERTIES
        INTERFACE_LINK_LIBRARIES omniORB4::thread-static
        )
endif()

foreach(tgt omniORB4::thread omniORB4::thread-static)
    if (TARGET ${tgt})
        # For other targets we hope that the appropriate macros are defined in omniconfig.h
        if (WIN32)
            # Assuming Windows XP or later, taken from omniORB4.2.5 README.win32.txt.
            # However, we don't set _WIN32_WINNT=0x0400 as they suggest as this
            # is a _minimum_ Windows version supported and the application is
            # free to increase the minimum if they wish.  If _WIN32_WINNT is
            # unset, then omnithread/nt.h sets it to 0x0400.
            set(_omniORB4_thread_options
                    /D__x86_64__
                    /D__NT__
                    /D__WIN32__
                    /D__OSVERSION__=4)
            set(_omniORB4_thread_libs ws2_32.lib mswsock.lib advapi32.lib)
        endif()
        set_target_properties(${tgt} PROPERTIES
            INTERFACE_COMPILE_OPTIONS "${_omniORB4_thread_options}"
            INTERFACE_LINK_LIBRARIES "${_omniORB4_thread_libs}"
        )
        unset(_omniORB4_thread_options)
        unset(_omniORB4_thread_libs)
    endif()
endforeach()