GH-50005: [C++] Use FetchContent for RapidJSON#50006
Conversation
|
|
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.
| 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
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
|
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 41b5fce. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 9 possible false positives for unstable benchmarks that are known to sometimes produce them. |
### Rationale for this change If we use `ExternalProject` and `CMAKE_FIND_USE_PACKAGE_REGISTRY` https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_USE_PACKAGE_REGISTRY.html and running `cmake` twice like apache#48801 (comment), `RapidJSONConfig.cmake` in `${BUILD_DIR}/rapidjson_ep/src/rapidjson_ep-install/lib/cmake/RapidjSON/`. It's not intentional. ### What changes are included in this PR? Use `FetchContent` instead of `ExternalProject`. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. * GitHub Issue: apache#50005 Lead-authored-by: Sutou Kouhei <kou@cozmixng.org> Co-authored-by: Sutou Kouhei <kou@clear-code.com> Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
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.