GH-50005: [C++] Use FetchContent for RapidJSON#50006
Open
kou wants to merge 1 commit into
Open
Conversation
|
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Arrow C++’s third-party dependency build logic to vendor RapidJSON via CMake FetchContent instead of ExternalProject, addressing unintended RapidJSONConfig.cmake side effects when the package registry is enabled and improving behavior with newer CMake versions.
Changes:
- Replace RapidJSON’s
ExternalProject_Addbuild/install flow withFetchContent_Declare+FetchContent_MakeAvailable. - Update RapidJSON include path wiring to reference the fetched source tree rather than an install prefix.
- Convert
build_rapidjsonfrom a macro to a function and propagateRAPIDJSON_VENDOREDviaPARENT_SCOPE.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
2799
to
2802
| add_library(RapidJSON INTERFACE IMPORTED) | ||
| target_include_directories(RapidJSON INTERFACE "${RAPIDJSON_INCLUDE_DIR}") | ||
| add_dependencies(RapidJSON rapidjson_ep) | ||
| target_include_directories(RapidJSON INTERFACE "${rapidjson_SOURCE_DIR}/include") | ||
| add_dependencies(RapidJSON rapidjson) | ||
|
|
a184453 to
9c0c088
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
If we use
ExternalProjectandCMAKE_FIND_USE_PACKAGE_REGISTRYhttps://cmake.org/cmake/help/latest/variable/CMAKE_FIND_USE_PACKAGE_REGISTRY.html and runningcmaketwice like #48801 (comment),RapidJSONConfig.cmakein${BUILD_DIR}/rapidjson_ep/src/rapidjson_ep-install/lib/cmake/RapidjSON/. It's not intentional.What changes are included in this PR?
Use
FetchContentinstead ofExternalProject.Are these changes tested?
Yes.
Are there any user-facing changes?
Yes.