Skip to content

GH-48801: [C++] Set CMAKE_POLICY_VERSION_MINIMUM for RapidJSON#49993

Merged
kou merged 1 commit into
apache:mainfrom
KyleFromNVIDIA:rapidjson-cmake-policy-version-minimum
May 21, 2026
Merged

GH-48801: [C++] Set CMAKE_POLICY_VERSION_MINIMUM for RapidJSON#49993
kou merged 1 commit into
apache:mainfrom
KyleFromNVIDIA:rapidjson-cmake-policy-version-minimum

Conversation

@KyleFromNVIDIA
Copy link
Copy Markdown
Contributor

@KyleFromNVIDIA KyleFromNVIDIA commented May 19, 2026

Rationale for this change

We already set this variable when adding projects through ExternalProject_Add(), but the config file that RapidJSON exports sets cmake_minimum_required() to a version older than 3.5. Set the policy minimum when searching for the just-built RapidJSON.

What changes are included in this PR?

Set CMAKE_POLICY_VERSION_MINIMUM in FindRapidJSONAlt.cmake

Are these changes tested?

Tested locally

Are there any user-facing changes?

We already set this variable when adding projects through
`ExternalProject_Add()`, but the config file that RapidJSON exports
sets `cmake_minimum_required()` to a version older than 3.5. Set
the policy minimum when searching for the just-built RapidJSON.
@github-actions
Copy link
Copy Markdown

⚠️ GitHub issue #48801 has been automatically assigned in GitHub to PR creator.

@github-actions
Copy link
Copy Markdown

⚠️ GitHub issue #48801 has been automatically assigned in GitHub to PR creator.

@KyleFromNVIDIA KyleFromNVIDIA changed the title GH-48801: [cmake] Set CMAKE_POLICY_VERSION_MINIMUM for RapidJSON GH-48801: [C++] Set CMAKE_POLICY_VERSION_MINIMUM for RapidJSON May 19, 2026
@github-actions
Copy link
Copy Markdown

⚠️ GitHub issue #48801 has been automatically assigned in GitHub to PR creator.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses CMake 4.x configuration failures caused by RapidJSON’s exported RapidJSONConfig.cmake using an old cmake_minimum_required() version by temporarily setting CMAKE_POLICY_VERSION_MINIMUM when FindRapidJSONAlt.cmake calls find_package(RapidJSON).

Changes:

  • Temporarily sets CMAKE_POLICY_VERSION_MINIMUM to 3.5 around find_package(RapidJSON ...) in the RapidJSON “Alt” find module.
  • Restores CMAKE_POLICY_VERSION_MINIMUM afterward.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +29 to +32
set(_CMAKE_POLICY_VERSION_MINIMUM_OLD ${CMAKE_POLICY_VERSION_MINIMUM})
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
find_package(RapidJSON ${find_package_args})
set(CMAKE_POLICY_VERSION_MINIMUM ${_CMAKE_POLICY_VERSION_MINIMUM_OLD})
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad review. Since ${_CMAKE_POLICY_VERSION_MINIMUM_OLD} is unquoted, if it's unset, CMAKE_POLICY_VERSION_MINIMUM will be unset rather than being set to an empty string. There is no scenario where CMAKE_POLICY_VERSION_MINIMUM being an empty string is valid, so the existing code covers all valid scenarios properly.

@kou
Copy link
Copy Markdown
Member

kou commented May 20, 2026

Error message: rapidsai/cudf#22540

@kou
Copy link
Copy Markdown
Member

kou commented May 20, 2026

GH-48801 is for bundled RapidJSON but this is for system RapidJSON.

@KyleFromNVIDIA
Copy link
Copy Markdown
Contributor Author

See my explanation at #48801 (comment). I think this PR is worth doing regardless.

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels May 20, 2026
@KyleFromNVIDIA
Copy link
Copy Markdown
Contributor Author

The failure in https://github.com/apache/arrow/actions/runs/26114813357/job/76866779105?pr=49993 looks unrelated to this PR. How can I get unstuck here?

@kou
Copy link
Copy Markdown
Member

kou commented May 21, 2026

It's already fixed in main. Rebasing on main will fix it.

Copy link
Copy Markdown
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@kou kou merged commit 1ef5e4a into apache:main May 21, 2026
53 of 55 checks passed
@kou kou removed the awaiting committer review Awaiting committer review label May 21, 2026
@conbench-apache-arrow
Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 1ef5e4a.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants