-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
FindV8.cmake
116 lines (110 loc) · 2.92 KB
/
FindV8.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
# Locate V8
# This module defines
# V8_LIBRARY
# V8_FOUND, if false, do not try to link to V8
# V8_INCLUDE_DIR, where to find the headers
FIND_PATH(V8_INCLUDE_DIR v8.h
${V8_DIR}/include
$ENV{V8_DIR}/include
$ENV{V8_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
/devel
)
# On non-Unix platforms (Mac and Windows specifically based on the forum),
# V8 builds separate shared (or at least linkable) libraries for v8_base and v8_snapshot
IF(NOT UNIX)
FIND_LIBRARY(V8_BASE_LIBRARY
NAMES v8_base v8_base.ia32 v8_base.x64 libv8_base
PATHS
${V8_DIR}
${V8_DIR}/lib
${V8_DIR}/build/Release/lib
$ENV{V8_DIR}
$ENV{V8_DIR}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(V8_SNAPSHOT_LIBRARY
NAMES v8_snapshot libv8_snapshot
PATHS
${V8_DIR}
${V8_DIR}/lib
${V8_DIR}/build/Release/lib
$ENV{V8_DIR}
$ENV{V8_DIR}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(V8_SNAPSHOT_LIBRARY_DEBUG
NAMES v8_snapshot libv8_snapshot
PATHS
${V8_DIR}
${V8_DIR}/lib
${V8_DIR}/build/Debug/lib
$ENV{V8_DIR}
$ENV{V8_DIR}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
# On Linux, there is just a libv8.so shared library built.
# (well, there are pseudo-static libraries libv8_base.a and libv8_snapshot.a
# but they don't seem to link correctly)
ELSE()
FIND_LIBRARY(V8_LIBRARY
NAMES v8
PATHS
${V8_DIR}
${V8_DIR}/lib
${V8_DIR}/build/Release/lib
# Having both architectures listed is problematic if both have been
# built (which is the default)
${V8_DIR}/out/ia32.release/lib.target/
${V8_DIR}/out/x64.release/lib.target/
$ENV{V8_DIR}
$ENV{V8_DIR}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
ENDIF(NOT UNIX)
include(FindPackageHandleStandardArgs)
IF(NOT UNIX)
find_package_handle_standard_args(V8 REQUIRED_VARS V8_BASE_LIBRARY V8_SNAPSHOT_LIBRARY V8_INCLUDE_DIR)
ELSE()
find_package_handle_standard_args(V8 REQUIRED_VARS V8_LIBRARY V8_INCLUDE_DIR)
ENDIF()