wesm commented on a change in pull request #7696: URL: https://github.com/apache/arrow/pull/7696#discussion_r453043649
########## File path: cpp/examples/minimal_build/CMakeLists.txt ########## @@ -19,10 +19,31 @@ cmake_minimum_required(VERSION 3.0) project(ArrowMinimalExample) +option(ARROW_LINK_SHARED "Link to the Arrow shared library" ON) + find_package(Arrow REQUIRED) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_BUILD_TYPE Release) + message(STATUS "Arrow version: ${ARROW_VERSION}") message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}") add_executable(arrow_example example.cc) -target_link_libraries(arrow_example PRIVATE arrow_shared) + +if (ARROW_LINK_SHARED) + target_link_libraries(arrow_example PRIVATE arrow_shared) +else() + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + + # We must also link to libarrow_bundled_dependencies.a + get_property(arrow_static_loc TARGET arrow_static PROPERTY LOCATION) + get_filename_component(arrow_lib_dir ${arrow_static_loc} DIRECTORY) + + add_library(arrow_dependencies STATIC IMPORTED) + set_target_properties(arrow_dependencies + PROPERTIES IMPORTED_LOCATION + "${arrow_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}") Review comment: I got this working, awesome! I'll update the docs ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org