I'm trying to build and link-to apache-arrow
v9.0.0
inside my cmake
project using the following section in my CMakeLists.txt
file.
ExternalProject_Add(arrow
URL "https://www.apache.org/dist/arrow/arrow-9.0.0/apache-arrow-9.0.0.tar.gz"
SOURCE_SUBDIR cpp)
message(STATUS "arrow source dir: ${arrow_SOURCE_DIR}")
include_directories(${arrow_SOURCE_DIR}/cpp/src)
The compilation complains that the apache-arrow
headers are missing
fatal error: 'arrow/array.h' file not found
#include <arrow/array.h>
^~~~~~~~~~~~~~~
1 error generated.
supported by the fact that the output of message(STATUS "arrow source dir: ${arrow_SOURCE_DIR}")
is empty
-- arrow source dir:
Another error seemingly related to the apache-arrow
installation reported by cmake
is that
CMake Error at cmake_modules/ThirdpartyToolchain.cmake:267 (find_package):
Could not find a configuration file for package "xsimd" that is compatible
with requested version "8.1.0".
The following configuration files were considered but not accepted:
/opt/homebrew/lib/cmake/xsimd/xsimdConfig.cmake, version: 9.0.1
Call Stack (most recent call first):
cmake_modules/ThirdpartyToolchain.cmake:2245 (resolve_dependency)
CMakeLists.txt:575 (include)
Of course, the traditional approach of installing apache-arrow
externally with say brew install apache-arrow
and using find_package
works well enough, but I'd like something more cross-platform. One of the arrow devs had provided a link on how to properly use include_directories
with ExternalProject_Add
for an earlier question, but I guess that example is now outdated.
What's the recommended way of installing and then linking-to apache-arrow
inside a cmake
project using ExternalProject_Add
?
Edit: Minimal Example
CMakeLists.txt
cmake_minimum_required(VERSION 3.24)
project(arrow_cmake)
set(CMAKE_CXX_STANDARD 23)
include(ExternalProject)
ExternalProject_Add(Arrow
URL "https://www.apache.org/dist/arrow/arrow-9.0.0/apache-arrow-9.0.0.tar.gz"
SOURCE_SUBDIR cpp
CMAKE_ARGS "-Dxsimd_SOURCE=BUNDLED"
)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} arrow_shared)
main.cpp
#include <iostream>
#include <arrow/array.h> // not found!
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}