blob: e3ec38c45806d4eb771db74bbeaf37d83c0bc7e4 (
plain)
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
|
FIND_PATH(V8_INCLUDE_DIR v8.h
PATH_SUFFIXES include
PATHS
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
HINTS $ENV{V8_SRC}
)
FIND_LIBRARY(V8_LIBRARY_BASE_RELEASE
NAMES v8_base v8
HINTS $ENV{V8_SRC}/out/native/
)
if (V8_LIBRARY_BASE_RELEASE)
list(APPEND V8_LIBRARY optimized ${V8_LIBRARY_BASE_RELEASE})
endif()
FIND_LIBRARY(V8_LIBRARY_SNAPSHOT_RELEASE
NAMES v8_snapshot
HINTS $ENV{V8_SRC}/out/native/
)
if (V8_LIBRARY_SNAPSHOT_RELEASE)
list(APPEND V8_LIBRARY optimized ${V8_LIBRARY_SNAPSHOT_RELEASE})
endif()
FIND_LIBRARY(V8_LIBRARY_BASE_DEBUG
NAMES v8_base_d v8_d v8_base_g v8_g
HINTS $ENV{V8_SRC}/out/native/
)
if (V8_LIBRARY_BASE_DEBUG)
list(APPEND V8_LIBRARY debug ${V8_LIBRARY_BASE_DEBUG})
else()
if (UNIX)
list(APPEND V8_LIBRARY debug ${V8_LIBRARY_BASE_RELEASE})
endif()
endif()
FIND_LIBRARY(V8_LIBRARY_SNAPSHOT_DEBUG
NAMES v8_snapshot_d
HINTS $ENV{V8_SRC}/out/native/
)
if (V8_LIBRARY_SNAPSHOT_DEBUG)
list(APPEND V8_LIBRARY debug ${V8_LIBRARY_SNAPSHOT_DEBUG})
else()
if (UNIX AND V8_LIBRARY_SNAPSHOT_RELEASE)
list(APPEND V8_LIBRARY debug ${V8_LIBRARY_SNAPSHOT_RELEASE})
endif()
endif()
# I have no idea how we would find the version otherwise :(
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES ${V8_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${V8_LIBRARY})
check_cxx_source_compiles("
#include <v8>
int main(){ v8::Array::New(v8::Isolate::GetCurrent()); }
" V8_VER_AFTER_032318)
if (NOT V8_VER_AFTER_032318)
message(STATUS "Your V8 installation is too old - we need >= 3.23.17")
unset(V8_LIBRARY)
unset(V8_INCLUDE_DIR)
endif()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(V8 DEFAULT_MSG V8_LIBRARY V8_INCLUDE_DIR)
MARK_AS_ADVANCED(V8_LIBRARY V8_INCLUDE_DIR)
|