Skip to content

Add FindRapidJSON.cmake - #154

Closed
awelzel wants to merge 1 commit into
masterfrom
topic/awelzel/unvendor-rapidjson
Closed

Add FindRapidJSON.cmake#154
awelzel wants to merge 1 commit into
masterfrom
topic/awelzel/unvendor-rapidjson

Conversation

@awelzel

@awelzel awelzel commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

The config mode version provided by OpenSuSE Leap 16.0 lowers the CMAKE_MINIMUM_REQUIRED_VERSION to 3.0. The workarounds are all annoying, so provide a simple FindRapidJSON.cmake file directly.

The config mode version provided by OpenSuSE Leap 16.0 lowers the
CMAKE_MINIMUM_REQUIRED_VERSION to 3.0. The workarounds are all annoying,
so provide a simple FindRapidJSON.cmake file directly.
@bbannier

Copy link
Copy Markdown
Member

The config mode version provided by OpenSuSE Leap 16.0 lowers the CMAKE_MINIMUM_REQUIRED_VERSION to 3.0. The workarounds are all annoying, so provide a simple FindRapidJSON.cmake file directly.

It isn't really clear to me what you work around here, but RapidJSON ships its own RapidJSONConfig.cmake so for me the following works out of the box.

cmake_minimum_required(VERSION 4.4)

find_package(RapidJSON REQUIRED)
add_library(rj rj.cc)
target_include_directories(rj PUBLIC ${RAPIDJSON_INCLUDE_DIRS}) # var name on 1.1.0
target_include_directories(rj PUBLIC ${RapidJSON_INCLUDE_DIRS}) # var name on `master`

RapidJSON hasn't put out a release in 10 years, and we currently use some unreleased snapshot of master. No idea what else changed there since 1.1.0.

@awelzel

awelzel commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

As in the description: The config mode version provided by OpenSuSE Leap 16.0 lowers the CMAKE_MINIMUM_REQUIRED_VERSION to 3.0.

25647eb7cff0:/ # lsb_release -a
LSB Version:    n/a
Distributor ID: openSUSE
Description:    openSUSE Leap 16.0
Release:        16.0
Codename:       n/a
25647eb7cff0:/ # head /usr/lib64/cmake/RapidJSON/RapidJSONConfig.cmake
################################################################################
# CMake minimum version required
cmake_minimum_required(VERSION 3.0)

The error is then about IN_LIST policy CMP0057 becoming unset.

RapidJSON hasn't put out a release in 10 years, and we currently use some unreleased snapshot of master. No idea what else changed there since 1.1.0.

I had assumed distros update anyhow (Fedora, for example, ships a snapshot from 2024), but the Ubuntu 24.04 build fails on Clang, so I think I'll just close this and maybe we try in a few years again.

@bbannier

Copy link
Copy Markdown
Member

I think instead of duplicating functionality a better way would be to fix the invocation to cmake_minimum_required. One way we could do this would be to override the function with a version which hardcodes our version.

# Override builtin `cmake_minimum_required` so we can control the passed `VERSION`.
macro(cmake_minimum_required)
  # Pass all arguments but `VERSION` which we override with what this project was configured with.
  cmake_parse_arguments(_CMR "" "VERSION" "" ${ARGN})
  _cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION} ${_CMR_UNPARSED_ARGUMENTS})
endmacro()

@awelzel awelzel closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants