Skip to content

[C++] CMake paths for IPC, Flight, Thrift, and Plasma don't support using Arrow as a subproject #20838

Closed

Description

@asfimport

Builds using Arrow as a CMake subproject (using add_subdirectory) will fail if the IPC, Flight, Thrift, or Plasma features are turned on. This issue is caused by the use of CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR which point to the top level directories of the CMake project (source and output, respectively).

In most of the cases where these paths are used, they are intended to point to the Arrow source and build dirs. Defining and using CMake variables for those top level Arrow folders solves the issue.

I will open a pull request to fix the issue.

A project that demonstrates the issue and the patch can be found here: https://github.com/mvilim/arrow-as-subproject

Note: there are several other locations in the repo where CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR are used (outside of the main cpp build, the cmake_modules, and the Gandiva subproject, for example). I hesitate to change these without an easy way to test all the possible build paths. I choosing a safe route here and changing only the most straightforward ones (and ones most likely to be used with Arrow as a subproject). If you would prefer I try to change all uses of these variables, let me know (and let me know if you have a straightforward way to test the supported build configurations).

Reporter: Michael Vilim / @mvilim
Assignee: Michael Vilim / @mvilim

PRs and other links:

Note: This issue was originally created as ARROW-4261. Please see the migration documentation for further details.

Activity

  1. asfimport commented on Jan 14, 2019

    @asfimport
    Author

    Wes McKinney / @wesm:
    Hm. I'm not sure that this is a use case that we should invest too much energy in supporting. The fixes that you've posted look fine (will review further), though.

    Part of the problem with using add_subdirectory is that it pollutes the calling environment indiscriminately. Generally we'd recommend using ExternalProject_Add instead

  2. asfimport commented on Jan 14, 2019

    @asfimport
    Author

    Michael Vilim / @mvilim:
    Using ExternalProject_Add instead of add_subdirectory makes sense to me. I don't have a large amount of CMake experience, and so I was unaware of that function.

    If that is the recommended approach, I am fine with rescinding the pull request.

  3. asfimport commented on Jan 14, 2019

    @asfimport
    Author

    Wes McKinney / @wesm:
    Interested in opinions of @xhochy and @pitrou. I can see the argument for using add_subdirectory which would import 100% of targets and variables into a CMake project. I think it's OK to have small fixes to enable that to work in some use cases, but in general that is not going to be the recommended way to include Arrow in another CMake project

  4. asfimport commented on Jan 14, 2019

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    I don't think we should promise anything here. However the fix looks simple enough that we can commit it as a best effort.

  5. asfimport commented on Jan 17, 2019

    @asfimport
    Author

    Uwe Korn / @xhochy:
    I agree with @pitrou here. We will accept small fixes for this but won't support this. For importing targets, we install a arrowTargets.cmake so you can use find_package(arrow) can get the correct imported targets.

  6. asfimport commented on Jan 18, 2019

    @asfimport
    Author

    Uwe Korn / @xhochy:
    Issue resolved by pull request 3396
    #3396

  7. added this to the 0.13.0 milestone on Jan 11, 2023
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions