Min. CMake job: CMAKE_POLICY_VERSION_MINIMUM is not passed for CMake 3.16 (follow-up to #358)

Open Beginner friendly
#359 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cmake, shell

Research direction

Find the script that assembles flags for the “Min. CMake” job and read the version threshold condition described in the issue. Check how the condition handles version 3.16.0, then update the flag behavior according to the suggested fix and verify the job can configure the CMake 3.16.0 tarball with CMake 4.4.4.

Written by the indexing model from the issue text.

Description

(Written by Claude Code, on behalf of @jll63.)

Follow-up to #358. The fix in 8f5e11bc0 does not take effect for CMake 3.16, so the Min. CMake job still fails with the same error, now on boost-ci 7163e84 (and 0a0a444):

https://github.com/boostorg/openmethod/actions/runs/42386369323/job/128444549964?pr=144

CMake Error at Source/kwsys/CMakeLists.txt:89 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 3.5 has been removed from CMake.

The flag is only added for versions older than 3.14:

min=3.14
if [[ "$version" != "$(printf '%s\n' "$min" "$version" | sort -V | tail -n1)" ]]; then
  flags+=("-DCMAKE_POLICY_VERSION_MINIMUM=3.5")
fi

3.16.0 is newer than 3.14, so for version=3.16.0 the condition is false and CMAKE_POLICY_VERSION_MINIMUM is not passed. The problem is the threshold: the comment assumes that sources newer than 3.14 no longer have minimums below 3.5, and that is not the case. The top-level CMakeLists.txt of 3.16.0 uses cmake_minimum_required(VERSION 3.1...3.15), which CMake 4 accepts, but Source/kwsys/CMakeLists.txt:89 is still CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR).

Checked locally, configuring the cmake-3.16.0 tarball with CMake 4.4.4:

  • without -DCMAKE_POLICY_VERSION_MINIMUM=3.5: fails at Source/kwsys/CMakeLists.txt:89, as in CI;
  • with it: configuring gets past kwsys.

Suggested fix: pass the flag unconditionally (CMake < 3.x ignores an unused -D cache entry), or raise min to a version that is verified to be free of pre-3.5 minimums.

Dominant language
Shell
Stars
18
Forks
24
Avg merge
16h 49m
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/boost-ci

All issues in boostorg/boost-ci

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.