You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++] CMake paths for IPC, Flight, Thrift, and Plasma don't support using Arrow as a subproject #20838
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.
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).
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
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.
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
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.
Activity
asfimport commentedon Jan 14, 2019
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_subdirectoryis that it pollutes the calling environment indiscriminately. Generally we'd recommend usingExternalProject_Addinsteadasfimport commentedon Jan 14, 2019
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.
asfimport commentedon Jan 14, 2019
Wes McKinney / @wesm:
Interested in opinions of @xhochy and @pitrou. I can see the argument for using
add_subdirectorywhich 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 projectasfimport commentedon Jan 14, 2019
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.
asfimport commentedon Jan 17, 2019
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.cmakeso you can usefind_package(arrow)can get the correct imported targets.asfimport commentedon Jan 18, 2019
Uwe Korn / @xhochy:
Issue resolved by pull request 3396
#3396