forked from obsproject/obs-browser
-
Notifications
You must be signed in to change notification settings - Fork 5
/
FindCEF.cmake
160 lines (132 loc) · 5.08 KB
/
FindCEF.cmake
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
include(FindPackageHandleStandardArgs)
set_property(CACHE CEF_ROOT_DIR PROPERTY HELPSTRING
"Path to CEF distributed build")
if(NOT DEFINED CEF_ROOT_DIR OR CEF_ROOT_DIR STREQUAL "")
message(
FATAL_ERROR
"CEF_ROOT_DIR is not set - if ENABLE_BROWSER is enabled, a CEF distribution with compiled wrapper library is required.\n"
"Please download a CEF distribution for your appropriate architecture and specify CEF_ROOT_DIR to its location"
)
endif()
find_path(CEF_INCLUDE_DIR "include/cef_version.h" HINTS "${CEF_ROOT_DIR}")
if(OS_MACOS)
find_library(
CEF_LIBRARY
NAMES cef libcef cef.lib libcef.o "Chromium Embedded Framework"
NO_DEFAULT_PATH
PATHS "${CEF_ROOT_DIR}" "${CEF_ROOT_DIR}/Release")
find_library(
CEFWRAPPER_LIBRARY
NAMES cef_dll_wrapper libcef_dll_wrapper
NO_DEFAULT_PATH
PATHS "${CEF_ROOT_DIR}/build/libcef_dll/Release"
"${CEF_ROOT_DIR}/build/libcef_dll_wrapper/Release"
"${CEF_ROOT_DIR}/build/libcef_dll"
"${CEF_ROOT_DIR}/build/libcef_dll_wrapper")
elseif(OS_POSIX)
find_library(
CEF_LIBRARY
NAMES libcef.so "Chromium Embedded Framework"
NO_DEFAULT_PATH
PATHS "${CEF_ROOT_DIR}" "${CEF_ROOT_DIR}/Release")
find_library(
CEFWRAPPER_LIBRARY
NAMES libcef_dll_wrapper.a
NO_DEFAULT_PATH
PATHS "${CEF_ROOT_DIR}/build/libcef_dll_wrapper"
"${CEF_ROOT_DIR}/libcef_dll_wrapper")
else()
find_library(
CEF_LIBRARY
NAMES cef libcef cef.lib libcef.o "Chromium Embedded Framework"
PATHS "${CEF_ROOT_DIR}" "${CEF_ROOT_DIR}/Release")
find_library(
CEFWRAPPER_LIBRARY
NAMES cef_dll_wrapper libcef_dll_wrapper
PATHS "${CEF_ROOT_DIR}/build/libcef_dll/Release"
"${CEF_ROOT_DIR}/build/libcef_dll_wrapper/Release"
"${CEF_ROOT_DIR}/build/libcef_dll"
"${CEF_ROOT_DIR}/build/libcef_dll_wrapper")
if(OS_WINDOWS)
find_library(
CEFWRAPPER_LIBRARY_DEBUG
NAMES cef_dll_wrapper libcef_dll_wrapper
PATHS "${CEF_ROOT_DIR}/build/libcef_dll/Debug"
"${CEF_ROOT_DIR}/build/libcef_dll_wrapper/Debug")
endif()
endif()
mark_as_advanced(CEFWRAPPER_LIBRARY CEFWRAPPER_LIBRARY_DEBUG)
if(NOT CEF_LIBRARY)
message(
WARNING
" Could NOT find Chromium Embedded Framework library (missing: CEF_LIBRARY)"
)
set(CEF_FOUND FALSE)
return()
endif()
if(NOT CEFWRAPPER_LIBRARY)
message(
WARNING
" Could NOT find Chromium Embedded Framework wrapper library (missing: CEFWRAPPER_LIBRARY)"
)
set(CEF_FOUND FALSE)
return()
endif()
message(
STATUS
"Found Chromium Embedded Framework: ${CEF_LIBRARY};${CEF_WRAPPER_LIBRARY}")
if(OS_WINDOWS)
set(CEF_LIBRARIES ${CEF_LIBRARY} ${CEFWRAPPER_LIBRARY})
elseif(OS_MACOS)
if(BROWSER_LEGACY)
set(CEF_LIBRARIES ${CEFWRAPPER_LIBRARY} ${CEF_LIBRARY})
else()
set(CEF_LIBRARIES ${CEFWRAPPER_LIBRARY})
endif()
else()
set(CEF_LIBRARIES ${CEF_LIBRARY} optimized ${CEFWRAPPER_LIBRARY})
if(CEFWRAPPER_LIBRARY_DEBUG)
list(APPEND CEF_LIBRARIES debug ${CEFWRAPPER_LIBRARY_DEBUG})
endif()
endif()
find_package_handle_standard_args(CEF DEFAULT_MSG CEF_LIBRARY
CEFWRAPPER_LIBRARY CEF_INCLUDE_DIR)
mark_as_advanced(CEF_LIBRARY CEF_WRAPPER_LIBRARY CEF_LIBRARIES CEF_INCLUDE_DIR)
if(NOT TARGET CEF::Wrapper)
if(IS_ABSOLUTE "${CEF_LIBRARIES}")
add_library(CEF::Wrapper UNKNOWN IMPORTED)
add_library(CEF::Library UNKNOWN IMPORTED)
set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LOCATION
${CEFWRAPPER_LIBRARY})
set_target_properties(CEF::Library PROPERTIES IMPORTED_LOCATION
${CEF_LIBRARY})
if(DEFINED CEFWRAPPER_LIBRARY_DEBUG)
add_library(CEF::Wrapper_Debug UNKNOWN IMPORTED)
set_target_properties(
CEF::Wrapper_Debug PROPERTIES IMPORTED_LOCATION
${CEFWRAPPER_LIBRARY_DEBUG})
endif()
else()
add_library(CEF::Wrapper INTERFACE IMPORTED)
add_library(CEF::Library INTERFACE IMPORTED)
set_target_properties(CEF::Wrapper PROPERTIES IMPORTED_LIBNAME
${CEFWRAPPER_LIBRARY})
set_target_properties(CEF::Library PROPERTIES IMPORTED_LIBNAME
${CEF_LIBRARY})
if(DEFINED CEFWRAPPER_LIBRARY_DEBUG)
add_library(CEF::Wrapper_Debug INTERFACE IMPORTED)
set_target_properties(
CEF::Wrapper_Debug PROPERTIES IMPORTED_LIBNAME
${CEFWRAPPER_LIBRARY_DEBUG})
endif()
endif()
set_target_properties(CEF::Wrapper PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${CEF_INCLUDE_DIR}")
set_target_properties(CEF::Library PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${CEF_INCLUDE_DIR}")
if(DEFINED CEFWRAPPER_LIBRARY_DEBUG)
set_target_properties(
CEF::Wrapper_Debug PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${CEF_INCLUDE_DIR}")
endif()
endif()