forked from heavyai/heavydb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindArrow.cmake
115 lines (103 loc) · 2.75 KB
/
FindArrow.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
#.rst:
# FindArrow.cmake
# -------------
#
# Find a Arrow installation.
#
# This module finds if Arrow is installed and selects a default
# configuration to use.
#
# find_package(Arrow ...)
#
#
# The following variables control which libraries are found::
#
# Arrow_USE_STATIC_LIBS - Set to ON to force use of static libraries.
#
# The following are set after the configuration is done:
#
# ::
#
# Arrow_FOUND - Set to TRUE if Arrow was found.
# Arrow_LIBRARIES - Path to the Arrow libraries.
# Arrow_LIBRARY_DIRS - compile time link directories
# Arrow_INCLUDE_DIRS - compile time include directories
#
#
# Sample usage:
#
# ::
#
# find_package(Arrow)
# if(Arrow_FOUND)
# target_link_libraries(<YourTarget> ${Arrow_LIBRARIES})
# endif()
if(Arrow_USE_STATIC_LIBS)
set(_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
find_library(Arrow_LIBRARY
NAMES arrow
HINTS
ENV LD_LIBRARY_PATH
ENV DYLD_LIBRARY_PATH
PATHS
/usr/lib
/usr/local/lib
/usr/local/homebrew/lib
/opt/local/lib)
find_library(Arrow_DC_LIBRARY
NAMES double-conversion
HINTS
ENV LD_LIBRARY_PATH
ENV DYLD_LIBRARY_PATH
PATHS
/usr/lib
/usr/local/lib
/usr/local/homebrew/lib
/opt/local/lib)
find_library(Arrow_GPU_CUDA_LIBRARY
NAMES arrow_cuda
HINTS
ENV LD_LIBRARY_PATH
ENV DYLD_LIBRARY_PATH
PATHS
/usr/lib
/usr/local/lib
/usr/local/homebrew/lib
/opt/local/lib)
if(Arrow_USE_STATIC_LIBS)
find_library(Arrow_DEPS_LIBRARY
NAMES arrow_bundled_dependencies
HINTS
ENV LD_LIBRARY_PATH
ENV DYLD_LIBRARY_PATH
PATHS
/usr/lib
/usr/local/lib
/usr/local/homebrew/lib
/opt/local/lib)
else()
set(Arrow_DEPS_LIBRARY "")
endif()
get_filename_component(Arrow_LIBRARY_DIR ${Arrow_LIBRARY} DIRECTORY)
if(Arrow_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
# Set standard CMake FindPackage variables if found.
set(Arrow_LIBRARIES ${Arrow_LIBRARY} ${Arrow_DC_LIBRARY} ${Arrow_DEPS_LIBRARY})
set(Arrow_GPU_CUDA_LIBRARIES ${Arrow_GPU_CUDA_LIBRARY})
set(Arrow_LIBRARY_DIRS ${Arrow_LIBRARY_DIR})
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND MSVC)
set(Arrow_INCLUDE_DIRS ${Arrow_LIBRARY_DIR}/../../include)
else()
set(Arrow_INCLUDE_DIRS ${Arrow_LIBRARY_DIR}/../include)
endif()
# Arrow 4+ defines the default io context slightly differently
try_compile(HAVE_ARROW_4_IO_CONTEXT
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/cmake/Modules/arrow_4_io_context.cpp
COMPILE_DEFINITIONS -I${Arrow_INCLUDE_DIRS} -std=c++17
LINK_LIBRARIES ${Arrow_LIBRARY} ${Arrow_DEPS_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Arrow REQUIRED_VARS Arrow_LIBRARY)