File: FindApple.cmake

package info (click to toggle)
webkit2gtk 2.42.2-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 362,452 kB
  • sloc: cpp: 2,881,971; javascript: 282,447; ansic: 134,088; python: 43,789; ruby: 18,308; perl: 15,872; asm: 14,389; xml: 4,395; yacc: 2,350; sh: 2,074; java: 1,734; lex: 1,323; makefile: 288; pascal: 60
file content (208 lines) | stat: -rw-r--r-- 7,061 bytes parent folder | download | duplicates (10)
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
# Copyright (C) 2022 Sony Interactive Entertainment Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.

#[=======================================================================[.rst:
FindApple
--------------

Find Apple frameworks.

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

  Apple::<C>

Where ``<C>`` is the name of an Apple framework, for example
``Apple::CoreFoundation``.

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

Apple component libraries are reported in::

  <C>_FOUND - ON if framework was found
  <C>_LIBRARIES - libraries for component

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

set(_Apple_REQUIRED_LIBS_FOUND YES)

function(_FIND_APPLE_FRAMEWORK framework)
    set(OPTIONS "")
    set(oneValueArgs HEADER)
    set(multiValueArgs LIBRARY_NAMES)
    cmake_parse_arguments(opt "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

    # Find include directory and library
    find_path(${framework}_INCLUDE_DIR NAMES ${opt_HEADER})
    find_library(${framework}_LIBRARY NAMES ${opt_LIBRARY_NAMES})

    if (${framework}_INCLUDE_DIR AND ${framework}_LIBRARY)
        add_library(Apple::${framework} UNKNOWN IMPORTED)
        set_target_properties(Apple::${framework} PROPERTIES
            INTERFACE_INCLUDE_DIRECTORIES "${${framework}_INCLUDE_DIR}"
            IMPORTED_LOCATION "${${framework}_LIBRARY}"
        )
        set(${framework}_FOUND ON PARENT_SCOPE)
        if (Apple_FIND_REQUIRED_${framework})
            set(Apple_LIBS_FOUND ${Apple_LIBS_FOUND} "${framework} (required): ${${framework}_LIBRARY}" PARENT_SCOPE)
        else ()
            set(Apple_LIBS_FOUND ${Apple_LIBS_FOUND} "${framework} (optional): ${${framework}_LIBRARY}}" PARENT_SCOPE)
        endif ()
    else ()
        if (Apple_FIND_REQUIRED_${framework})
            set(_Apple_REQUIRED_LIBS_FOUND NO PARENT_SCOPE)
            set(Apple_LIBS_NOT_FOUND ${Apple_LIBS_NOT_FOUND} "${framework} (required)" PARENT_SCOPE)
        else ()
            set(Apple_LIBS_NOT_FOUND ${Apple_LIBS_NOT_FOUND} "${framework} (optional)" PARENT_SCOPE)
        endif ()
    endif ()

    mark_as_advanced(${framework}_INCLUDE_DIR ${framework}_LIBRARY)
endfunction()

if ("ApplicationServices" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(ApplicationServices
        HEADER ApplicationServices/ApplicationServices.h
        LIBRARY_NAMES ASL${DEBUG_SUFFIX}
    )
endif ()

if ("AVFoundationCF" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(AVFoundationCF
        HEADER AVFoundationCF/AVFoundationCF.h
        LIBRARY_NAMES AVFoundationCF${DEBUG_SUFFIX}
    )
endif ()

if ("CFNetwork" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(CFNetwork
        HEADER CFNetwork/CFNetwork.h
        LIBRARY_NAMES CFNetwork${DEBUG_SUFFIX}
    )
endif ()

if ("CoreAudio" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(CoreAudio
        HEADER CoreAudio/CoreAudioTypes.h
        LIBRARY_NAMES CoreAudioToolbox${DEBUG_SUFFIX}
    )
endif ()

if ("CoreFoundation" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(CoreFoundation
        HEADER CoreFoundation/CoreFoundation.h
        LIBRARY_NAMES CoreFoundation${DEBUG_SUFFIX}
    )
endif ()

if ("CoreGraphics" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(CoreGraphics
        HEADER CoreGraphics/CoreGraphics.h
        LIBRARY_NAMES CoreGraphics${DEBUG_SUFFIX}
    )
endif ()

if ("CoreMedia" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(CoreMedia
        HEADER CoreMedia/CoreMedia.h
        LIBRARY_NAMES CoreMedia${DEBUG_SUFFIX}
    )
endif ()

if ("CoreText" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(CoreText
        HEADER CoreText/CoreText.h
        LIBRARY_NAMES CoreText${DEBUG_SUFFIX}
    )
endif ()

if ("CoreVideo" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(CoreVideo
        HEADER CoreVideo/CVBase.h
        LIBRARY_NAMES CoreVideo${DEBUG_SUFFIX}
    )
endif ()

if ("MediaAccessibility" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(MediaAccessibility
        HEADER MediaAccessibility/MediaAccessibility.h
        LIBRARY_NAMES MediaAccessibility${DEBUG_SUFFIX}
    )
endif ()

if ("MediaToolbox" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(MediaToolbox
        HEADER MediaToolbox/MTAudioProcessingTap.h
        LIBRARY_NAMES MediaToolbox${DEBUG_SUFFIX}
    )
endif ()

if ("QuartzCore" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(QuartzCore
        HEADER QuartzCore/QuartzCore.h
        LIBRARY_NAMES QuartzCore${DEBUG_SUFFIX}
    )
endif ()

if ("SarfariTheme" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(SarfariTheme
        HEADER dispatch/dispatch.h
        LIBRARY_NAMES SarfariTheme${DEBUG_SUFFIX}
    )
endif ()

if ("WebKitQuartzCoreAdditions" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(WebKitQuartzCoreAdditions
        HEADER WebKitQuartzCoreAdditions/WebKitQuartzCoreAdditionsBase.h
        LIBRARY_NAMES WebKitQuartzCoreAdditions${DEBUG_SUFFIX}
    )
endif ()

if ("libdispatch" IN_LIST Apple_FIND_COMPONENTS)
    _FIND_APPLE_FRAMEWORK(libdispatch
        HEADER dispatch/dispatch.h
        LIBRARY_NAMES libdispatch${DEBUG_SUFFIX}
    )
endif ()

if (NOT Apple_FIND_QUIETLY)
    if (Apple_LIBS_FOUND)
        message(STATUS "Found the following Apple libraries:")
        foreach (found ${Apple_LIBS_FOUND})
            message(STATUS " ${found}")
        endforeach ()
    endif ()
    if (Apple_LIBS_NOT_FOUND)
        message(STATUS "The following Apple libraries were not found:")
        foreach (found ${Apple_LIBS_NOT_FOUND})
            message(STATUS " ${found}")
        endforeach ()
    endif ()
endif ()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Apple
    REQUIRED_VARS _Apple_REQUIRED_LIBS_FOUND
    FAIL_MESSAGE "Failed to find all Apple components"
)