Skip to content

[C++] Export arrow_bundled_dependencies by install(TARGETS) instead of creating it in ArrowConfig.cmake #55583

Open

Description

@kou

Describe the enhancement requested

arrow_create_merged_static_lib() creates arrow_bundled_dependencies as an IMPORTED library. We can't use install(TARGETS) for it. So we install only the archive by install(FILES) and create Arrow::arrow_bundled_dependencies manually in ArrowConfig.cmake.

So ArrowConfig.cmake needs to do things that CMake usually does for us:

if(TARGET Arrow::arrow_static AND NOT TARGET Arrow::arrow_bundled_dependencies)
add_library(Arrow::arrow_bundled_dependencies STATIC IMPORTED)
get_target_property(arrow_static_configurations Arrow::arrow_static
IMPORTED_CONFIGURATIONS)
foreach(CONFIGURATION ${arrow_static_configurations})
string(TOUPPER "${CONFIGURATION}" CONFIGURATION)
get_target_property(arrow_static_location Arrow::arrow_static
LOCATION_${CONFIGURATION})
get_filename_component(arrow_lib_dir "${arrow_static_location}" DIRECTORY)
set_property(TARGET Arrow::arrow_bundled_dependencies
APPEND
PROPERTY IMPORTED_CONFIGURATIONS ${CONFIGURATION})
set_target_properties(Arrow::arrow_bundled_dependencies
PROPERTIES IMPORTED_LOCATION_${CONFIGURATION}
"${arrow_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endforeach()
# CMP0057: Support new if() IN_LIST operator.
# https://cmake.org/cmake/help/latest/policy/CMP0057.html
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)
if("aws-c-common" IN_LIST ARROW_BUNDLED_STATIC_LIBS)
if(APPLE)
find_library(CORE_FOUNDATION CoreFoundation)
target_link_libraries(Arrow::arrow_bundled_dependencies
INTERFACE ${CORE_FOUNDATION})
find_library(NETWORK Network)
target_link_libraries(Arrow::arrow_bundled_dependencies INTERFACE ${NETWORK})
find_library(SECURITY Security)
target_link_libraries(Arrow::arrow_bundled_dependencies INTERFACE ${SECURITY})
elseif(WIN32)
target_link_libraries(Arrow::arrow_bundled_dependencies
INTERFACE "winhttp.lib"
"bcrypt.lib"
"wininet.lib"
"userenv.lib"
"version.lib"
"ncrypt.lib"
"Secur32.lib"
"Shlwapi.lib")
endif()
endif()
cmake_policy(POP)
endif()

We know everything about the bundled dependencies at build time. We should define arrow_bundled_dependencies as a normal (not IMPORTED) static library target with its dependencies and export it by install(TARGETS ... EXPORT ...). Then we can remove the code that creates Arrow::arrow_bundled_dependencies from ArrowConfig.cmake. Each bundled dependency can declare the libraries it needs where we build it in ThirdpartyToolchain.cmake. We can do the same for arrow_gcs_bundled_dependencies.

Component(s)

C++

Activity

  1. AnuragRaut08 commented on Nov 14, 2026

    @AnuragRaut08
    Contributor

    I'd like to take this up. I'll look into replacing the manually created imported targets with properly exported static library targets and simplify the corresponding ArrowConfig.cmake logic, including the GCS bundled dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions