Skip to content

Increase minimum supported CMake version from 3.5.1 to 3.12#1973

Merged
Dead2 merged 1 commit intodevelopfrom
cmake-ver
Oct 7, 2025
Merged

Increase minimum supported CMake version from 3.5.1 to 3.12#1973
Dead2 merged 1 commit intodevelopfrom
cmake-ver

Conversation

@Dead2
Copy link
Copy Markdown
Member

@Dead2 Dead2 commented Oct 2, 2025

Through the years, we have not actually bumped the minimum CMake version we support, and that has sometimes meant having to implement things in a more difficult way or turning down contributions altogether since it would not be possible to support. (Publicly we have bumped the minimum, but in fact we haven't bumped the actual version checks, see below).

Backwards compatibility with CMake version 3.5 is also no longer supported by newer CMake releases, and 3.10 has been deprecated. This does not impact us negatively currently, but it might at some point.

Changed in version 4.0: Compatibility with versions of CMake older than 3.5 is removed. Calls to cmake_minimum_required(VERSION) or cmake_policy(VERSION) that do not specify at least 3.5 as their policy version (optionally via ...) will produce an error in CMake 4.0 and above.

Changed in version 3.31: Compatibility with versions of CMake older than 3.10 is deprecated. Calls to cmake_minimum_required(VERSION) or cmake_policy(VERSION) that do not specify at least 3.10 as their policy version (optionally via ...) will produce a deprecation warning in CMake 3.31 and above.

For the upcoming 2.3.x release series, I'd like to bump the minimum CMake version we support, and I'd like to suggest 3.12.

I chose to suggest 3.12 based on what features we already depend on for Google Benchmark and what I could find that various Linux distros are shipping, it seems like a good middle ground between keeping up with new features and keeping backwards compatibility. We could also choose 3.14, but I haven't found any new feature that would require that, in fact I didn't see anything interesting until 3.18, and even that was not really that interesting.

We currently specify 3.14 as the minimum CMake version we pledge to support for 2.1.x/2.2.x on the Wiki. I guess we could edit that to say 3.12 now that those releases won't have any new features that would require updating the version. Should we say 3.12 for 2.3.x as well if we land on that for the actual CMake requirement?
Ref: https://github.com/zlib-ng/zlib-ng/wiki

For reference:
3.5 released 2016
3.12 released 2018
3.14 release 2019


In addition to a plethora of general improvements, such as improved understanding of compilers, platforms, libraries, etc, these CMake features improvements stood out to me while reading through the release notes as things we might want to utilize:

3.6:

  • A CMAKE_TRY_COMPILE_PLATFORM_VARIABLES variable was added for use by toolchain files to specify platform-specific variables that must be propagated by the try_compile() command into test projects.
  • A CMAKE_TRY_COMPILE_TARGET_TYPE variable was added to optionally tell the try_compile() command to build a static library instead of an executable. This is useful for cross-compiling toolchains that cannot link binaries without custom flags or scripts.

3.7:

  • The if() command gained new boolean comparison operations LESS_EQUAL, GREATER_EQUAL, STRLESS_EQUAL, STRGREATER_EQUAL, VERSION_LESS_EQUAL, and VERSION_GREATER_EQUAL.

3.9:

3.10:

3.12:

  • The cmake_minimum_required() and cmake_policy(VERSION) commands now accept a version range using the form [...]. This allows projects to specify a range of versions for which they have been updated and avoid explicit policy settings.

Summary by CodeRabbit

  • New Requirements
    • Raised minimum CMake version to 3.12 (now supports 3.12–3.29).
  • Chores
    • Configure step now shows the detected CMake version.
  • Tests
    • Simplified benchmark build logic; benchmarks are no longer auto-disabled based on CMake version (note: overall project now requires CMake 3.12+).

@Dead2 Dead2 added cleanup Improving maintainability or removing code. Build Env labels Oct 2, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 2, 2025

Walkthrough

Raised CMake minimum to 3.12, removed legacy cmake_policy handling, and added a status message printing the detected CMake version. In tests, removed the CMake-version gate that disabled benchmarks, leaving benchmark configuration unguarded by CMake version.

Changes

Cohort / File(s) Summary of changes
Root build configuration
CMakeLists.txt
Set cmake_minimum_required to 3.12...3.29.0; removed conditional cmake_policy(VERSION ...) block; added message(STATUS "Using CMake version ${CMAKE_VERSION}").
Test/bench build gating
test/CMakeLists.txt
Removed conditional that warned and disabled WITH_BENCHMARKS for CMake < 3.12; benchmarks no longer gated by CMake version.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title clearly and succinctly summarizes the primary change of raising the minimum CMake version from 3.5.1 to 3.12, aligning perfectly with the pull request’s purpose and making it immediately obvious to reviewers.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cmake-ver

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.41%. Comparing base (46cf470) to head (21b01d2).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1973      +/-   ##
===========================================
- Coverage    83.89%   79.41%   -4.49%     
===========================================
  Files          163      161       -2     
  Lines        14073    14491     +418     
  Branches      3165     3469     +304     
===========================================
- Hits         11807    11508     -299     
- Misses        1241     1952     +711     
- Partials      1025     1031       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dead2 Dead2 changed the title [RFC] Increase minimum supported CMake version from 3.5.1 to 3.12 Increase minimum supported CMake version from 3.5.1 to 3.12 Oct 5, 2025
@Dead2 Dead2 merged commit af23de4 into develop Oct 7, 2025
302 of 303 checks passed
@Dead2 Dead2 mentioned this pull request Nov 5, 2025
@Dead2 Dead2 deleted the cmake-ver branch November 29, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build Env cleanup Improving maintainability or removing code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants