Skip to content

Conversation

@ppisar
Copy link
Contributor

@ppisar ppisar commented Mar 4, 2025

CMake 4.0.0 removed a support for CMake scripts older than 3.5 and a build with CMake 4.0.0-rc2 fails like this:

$ /usr/bin/cmake -S . -B redhat-linux-build
CMake Warning (dev) at CMakeLists.txt:1 (PROJECT):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at CMakeLists.txt:3 (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!

There seems to be no way of making the script working with all versions. CMake 3.5 was relased in 2016.

This patch increases the minimal version to 3.5 and moves it to the top of the script as it needs to be the very first thing of a script as recommeded by cmake:

CMake Warning (dev) at CMakeLists.txt:1 (PROJECT):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.

I did not set a supported upper version of CMake since I guess we do not want to update it with every new minor CMake release.

Other printed CMake warnings are not news are not addressed with this patch.

CMake 4.0.0 removed a support for CMake scripts older than 3.5 and a build
with CMake 4.0.0-rc2 fails like this:

    $ /usr/bin/cmake -S . -B redhat-linux-build
    CMake Warning (dev) at CMakeLists.txt:1 (PROJECT):
      cmake_minimum_required() should be called prior to this top-level project()
      call.  Please see the cmake-commands(7) manual for usage documentation of
      both commands.
    This warning is for project developers.  Use -Wno-dev to suppress it.

    CMake Error at CMakeLists.txt:3 (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!

There seems to be no way of making the script working with all
versions. CMake 3.5 was relased in 2016.

This patch increases the minimal version to 3.5 and moves it to the top
of the script as it needs to be the very first thing of a script as
recommeded by cmake:

    CMake Warning (dev) at CMakeLists.txt:1 (PROJECT):
      cmake_minimum_required() should be called prior to this top-level project()
      call.  Please see the cmake-commands(7) manual for usage documentation of
      both commands.

I did not set a supported upper version of CMake since I guess
we do not want to update it with every new minor CMake release.

Other printed CMake warnings are not news are not addressed with
this patch.
@ppisar
Copy link
Contributor Author

ppisar commented Mar 4, 2025

I forgot to update the spec file. Now done.

@gruenich
Copy link
Contributor

gruenich commented Mar 5, 2025

Would it not be better to extend #575 ?

@ppisar
Copy link
Contributor Author

ppisar commented Mar 6, 2025

#575 is version-wise a superset of this pull request. You are its author, so extend it to cover the spec file.

I'm fine with whichever pull request of these two.

@mlschroe mlschroe merged commit 768c8f4 into openSUSE:master Mar 19, 2025
1 check passed
@mlschroe
Copy link
Member

Ok, looks reasonable. Thanks!

@gruenich
Copy link
Contributor

@mlschroe Was there a reason to not update the required minimum version to CMake 3.10 / #575? Should I rebase my merge request or should I close it?

@mlschroe
Copy link
Member

If 3.5 still works I don't see a reason to block it. Regarding your pull request, I'll close it.

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.

4 participants