]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Increase CMake version to 3.5 581/head
authorPetr Písař <ppisar@redhat.com>
Tue, 4 Mar 2025 08:02:22 +0000 (09:02 +0100)
committerPetr Písař <ppisar@redhat.com>
Tue, 4 Mar 2025 10:51:07 +0000 (11:51 +0100)
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.

CMakeLists.txt
package/libsolv.spec.in

index e344222c7f52ad25e20bc3b6bc0a7228cdaf75e6..f0c6d4f9575677eed75c31841771218bc99859ae 100644 (file)
@@ -1,6 +1,6 @@
-PROJECT (libsolv C)
+CMAKE_MINIMUM_REQUIRED (VERSION 3.5)
 
-CMAKE_MINIMUM_REQUIRED (VERSION 2.8.5)
+PROJECT (libsolv C)
 
 OPTION (ENABLE_STATIC "Build a static version of the libraries?" OFF)
 OPTION (DISABLE_SHARED "Do not build a shared version of the libraries?" OFF)
index dde4f7a1e94bafa03a96adf04ae1270bf6406097..2ee3f185033b64324aa040c0b97295960473c370 100644 (file)
@@ -72,7 +72,7 @@ License:        BSD-3-Clause
 Group:          Development/Libraries/C and C++
 URL:            https://github.com/openSUSE/libsolv
 Source:         libsolv-%{version}.tar.bz2
-BuildRequires:  cmake
+BuildRequires:  cmake >= 3.5
 BuildRequires:  gcc-c++
 BuildRequires:  libxml2-devel
 BuildRequires:  rpm-devel