Skip to content

Fix CMake compatibility with modern CMake (>= 4.0) - #1238

Merged
lucaderi merged 1 commit into
ntop:3.0-stablefrom
mchsk:fix-cmake-compat
Jun 21, 2026
Merged

Fix CMake compatibility with modern CMake (>= 4.0)#1238
lucaderi merged 1 commit into
ntop:3.0-stablefrom
mchsk:fix-cmake-compat

Conversation

@mchsk

@mchsk mchsk commented Mar 2, 2026

Copy link
Copy Markdown

Summary

The CMake workflow (cmake-linux.yml) fails on macos-latest because the runner now ships CMake 4.x, which dropped compatibility with versions below 3.5.

Two issues in CMakeLists.txt:

  1. project() was called before cmake_minimum_required() — CMake requires the opposite order
  2. cmake_minimum_required(VERSION 2.6) — version 2.6 is rejected by CMake >= 4.0

Fix

  • Reorder so cmake_minimum_required() comes first
  • Use VERSION 3.5...3.31 range syntax: floor of 3.5 (oldest CMake still supported by modern CMake) with policies up to 3.31

Before

project(n2n)
cmake_minimum_required(VERSION 2.6)

After

cmake_minimum_required(VERSION 3.5...3.31)
project(n2n)

Test plan

  • CMake workflow should now pass on all three platforms (ubuntu-latest, macos-latest, windows-latest)

- Move cmake_minimum_required() before project() as required
- Bump minimum version from 2.6 to 3.5 (CMake 4.0 dropped
  support for < 3.5)
- Use 3.5...3.31 version range to indicate the project works
  with policies up to CMake 3.31 while keeping 3.5 as the floor

Made-with: Cursor
@mchsk

mchsk commented Mar 2, 2026

Copy link
Copy Markdown
Author

@lucaderi this one could potentially be the last one as I noticed that after merging to 3.0-stable there is one GH action passing but one failing. This should be a fix for the failing one

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.38%. Comparing base (6dac89f) to head (d6e2e97).
⚠️ Report is 4 commits behind head on 3.0-stable.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@              Coverage Diff               @@
##           3.0-stable    #1238      +/-   ##
==============================================
+ Coverage       18.31%   21.38%   +3.07%     
==============================================
  Files              41       45       +4     
  Lines            8589     9161     +572     
  Branches            0     1235    +1235     
==============================================
+ Hits             1573     1959     +386     
- Misses           7016     7202     +186     

☔ 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.

@mchsk

mchsk commented Mar 6, 2026

Copy link
Copy Markdown
Author

@lucaderi Hi Luca, this is a nice to have :-) Ez to merge.

@lucaderi
lucaderi merged commit 3d5a88f into ntop:3.0-stable Jun 21, 2026
22 checks passed
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.

3 participants