Skip to content

Conversation

Flamefire
Copy link

CMake 4 removed compatibility with CMake 3.5 so no valid generator will be found as the test CMakeLists.txt causes an error.

Use the current CMake version to set the required version to avoid this

Current CMake version used is 4.1. The error looks like:

    -- Trying "Ninja" generator
    --------------------------------
    ---------------------------
    ----------------------
    -----------------
    ------------
    -------
    --
    Not searching for unused variables given on the command line.
    CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
      Compatibility with CMake < 3.5 has been removed from CMake.
    
      Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
      to tell CMake that the project requires at least <min> but has been updated
      to work with policies introduced by <max> or earlier.
    
      Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
    
    
    -- Configuring incomplete, errors occurred!
    --
    -------
    ------------
    -----------------
    ----------------------
    ---------------------------
    --------------------------------
    -- Trying "Ninja" generator - failure
...
    scikit-build could not get a working generator for your system. Aborting build.

BTW: Is there an easy way for a user to tell scikit-build to use an installed CMake instead of downloading one? That would also resolve this as the user can choose a lower version

CMake 4 removed compatibility with CMake 3.5 so no valid generator will be found as the test CMakeLists.txt causes an error.

Use the current CMake version to set the required version to avoid this
@emilazy
Copy link

emilazy commented Sep 17, 2025

I don’t think this will fix it. 3.5 is still supported; it’s the 3.2 in test_issue335_support_cmake_source_dir and an error message in test_make_without_configure_fails that break the tests. Did you successfully build with this PR?

I’ve put up #1160, which fixed the build for me in Nixpkgs.

@emilazy
Copy link

emilazy commented Sep 17, 2025

Ah, I guess perhaps this fixes something about the build system orchestration itself, which isn’t expecting the CMake warning, without affecting the tests? I suppose we are bypassing that layer in Nixpkgs so we haven’t noticed it…

Both PRs might be needed, then.

@Flamefire
Copy link
Author

Flamefire commented Sep 18, 2025

which isn’t expecting the CMake warning,

CMake actually fails, i.e. it is not just a warning

I don’t think this will fix it. 3.5 is still supported; it’s the 3.2 in test_issue335_support_cmake_source_dir and an error message in test_make_without_configure_fails that break the tests. Did you successfully build with this PR?

I'm actually encountered this when using scikit-build 0.11.1 when building a 3rd-party package. This change fixed the build.

However after looking at the error message again you are right: It is < 3.5 not 3.5+. And in 0.11.1 this line reads 2.8 which rightly triggers the error.

Anyway: CMake 3.10 is deprecated and will be removed in a similar way, so this is just waiting to become an issue (again) and hence this change is required for future-proofing this code

Both PRs might be needed, then.

To make the tests pass yes.

@Flamefire
Copy link
Author

I added 2 more commits :

The first shows the CMake version used. With this the output will start with:

    Using CMake 4.1
    Not searching for unused variables given on the command line.
    CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
      Compatibility with CMake < 3.5 has been removed from CMake.

The other is just a minor doc enhancement to show using 3.5...3.20 CMake version ranges to keep the example working when <3.10 is dropped

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