2

Below is the solution that worked for me, but not sure if it is the best way to do this. I used brew to install it. vcpkg does not work at the moment, unfortunately. What I don't like about this solution is that I need to set Parquet_DIR and find_package(Parquet) separately.

set(Parquet_DIR /usr/local/lib/cmake/arrow)

find_package(Arrow CONFIG REQUIRED)
find_package(Parquet CONFIG REQUIRED)
target_link_libraries(database PRIVATE arrow_shared parquet_shared)
Amir
  • 189
  • 2
  • 12

3 Answers3

4

You can pass PATHS to search to find_package.

You may also want to prevent searching in other places by passing NO_DEFAULT_PATH.

See find_package documentation

find_package(Arrow CONFIG REQUIRED)
find_package(Parquet CONFIG REQUIRED
    PATHS /usr/local/lib/cmake/arrow
    NO_DEFAULT_PATH
)
target_link_libraries(database PRIVATE arrow_shared parquet_shared)

(The above snippet assumes that Arrow does not depend on the Parquet package.)

fabian
  • 80,457
  • 12
  • 86
  • 114
  • I like this solution better, however, is it really the best we can do? – Amir Jun 07 '21 at 18:52
  • @Amir If it does not work without specifying the path, you need to specify it somewhere. You may also just leave out `NO_DEFAULT_PATH`, if the package being found in some other location is ok for you too. There are other ways of passing the info where to search; some of the ways may be preferable in some scenarios, but in general I'd recommend this approach. The places where cmake may search for the packages are documented in the ["Search Procedure" section of the `find_package` docu](https://cmake.org/cmake/help/latest/command/find_package.html#search-procedure) – fabian Jun 07 '21 at 19:02
  • If it really require this I would report a bug to the developer. This is a broken directory structure for CMake packages. – Guillaume Racicot Jun 07 '21 at 20:39
  • Looks like it is a known issue https://issues.apache.org/jira/browse/ARROW-12175 for now I think this is the best working answer. – Amir Jun 08 '21 at 08:27
2

As fabian's workaround, you'd use find_package(Parquet CONFIG REQUIRED PATHS ${Arrow_DIR} NO_DEFAULT_PATH) to avoid absolute path, which is more flexiable.

0

I manage to build parquet only without using find_package or ExternalProject_Add. Here is my CMakeLists.txt:

# FetchContent and populate...
# Setting your CMake flags...
set(ARROW_SIMD_LEVEL "NONE" CACHE STRING "" FORCE)
set(ARROW_OPTIONAL_INSTALL OFF)
set(Thrift_SOURCE "BUNDLED")
set(BOOST_SOURCE "BUNDLED")
set(ARROW_BUILD_TESTS OFF)
set(ARROW_PARQUET ON)
set(PARQUET_MINIMAL_DEPENDENCY OFF)
include(CMakePackageConfigHelpers)
function(install)
endfunction()
add_subdirectory(${arrow_SOURCE_DIR}/cpp ${arrow_BINARY_DIR})
add_dependencies(parquet_objlib thrift_ep boost_ep) # Had to add this line. Not sure why the proper dependencies are not there.