Using Arrow C++ in your own project¶
This section assumes you already have the Arrow C++ libraries on your system, either after installing them using a package manager or after building them yourself.
The recommended way to integrate the Arrow C++ libraries in your own C++ project is to use CMake’s find_package function for locating and integrating dependencies. If you don’t use CMake as a build system, you can use pkg-config to find installed the Arrow C++ libraries.
CMake¶
Basic usage¶
This minimal CMakeLists.txt
file compiles a my_example.cc
source
file into an executable linked with the Arrow C++ shared library:
project(MyExample)
find_package(Arrow REQUIRED)
add_executable(my_example my_example.cc)
target_link_libraries(my_example PRIVATE arrow_shared)
Available variables and targets¶
The directive find_package(Arrow REQUIRED)
asks CMake to find an Arrow
C++ installation on your system. When it returns, it will have set a few
CMake variables:
${Arrow_FOUND}
is true if the Arrow C++ libraries have been found${ARROW_VERSION}
contains the Arrow version string${ARROW_FULL_SO_VERSION}
contains the Arrow DLL version string
In addition, it will have created some targets that you can link against (note these are plain strings, not variables):
arrow_shared
links to the Arrow shared librariesarrow_static
links to the Arrow static libraries
In most cases, it is recommended to use the Arrow shared libraries.
Note
CMake is case-sensitive. The names and variables listed above have to be spelt exactly that way!
See also
A Docker-based minimal build example.
pkg-config¶
Basic usage¶
You can get suitable build flags by the following command line:
pkg-config --cflags --libs arrow
If you want to link the Arrow C++ static library, you need to add
--static
option:
pkg-config --cflags --libs --static arrow
This minimal Makefile
file compiles a my_example.cc
source
file into an executable linked with the Arrow C++ shared library:
my_example: my_example.cc
$(CXX) -o $@ $(CXXFLAGS) $< $$(pkg-config --cflags --libs arrow)
Many build systems support pkg-config. For example:
CMake (But you should use
find_package(Arrow)
instead.)
Available packages¶
The Arrow C++ provides a pkg-config package for each module. Here are all available packages:
arrow-csv
arrow-cuda
arrow-dataset
arrow-filesystem
arrow-flight-testing
arrow-flight
arrow-json
arrow-orc
arrow-python-flight
arrow-python
arrow-tensorflow
arrow-testing
arrow
gandiva
parquet
plasma