Bug 424392 - Require CMake 3.18 due to list(… COMPARE NATURAL)
Summary: Require CMake 3.18 due to list(… COMPARE NATURAL)
Status: RESOLVED FIXED
Alias: None
Product: extra-cmake-modules
Classification: Frameworks and Libraries
Component: AndroidToolchain (show other bugs)
Version: 5.72.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-18 22:30 UTC by Matthias Ansorg
Modified: 2020-12-20 14:36 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Ansorg 2020-07-18 22:30:40 UTC
The current master toolchain/Android.cmake file says it requires CMake 3.7:

    cmake_minimum_required(VERSION "3.7")

However, it uses "list(PREPEND ...)" calls, such as in l. 165:

    list(PREPEND CMAKE_FIND_LIBRARY_SUFFIXES "_${CMAKE_ANDROID_ARCH_ABI}.so")

This syntax was introduced in CMake 3.15. Compare:

    https://cmake.org/cmake/help/v3.15/command/list.html
    https://cmake.org/cmake/help/v3.14/command/list.html

Consequentially, Android.cmake should require CMake 3.15. Otherwise, we'll see errors such as the following when using the file it with an earlier version of CMake (in my case 3.13.4 from Ubuntu 19.10 packages):

    CMake Error at /usr/local/share/ECM/toolchain/Android.cmake:165 (list):
    list does not recognize sub-command PREPEND
Comment 1 Nicolas Fella 2020-07-19 14:57:58 UTC
Seems reasonable and easy to fix. Would you like to sumbit a patch yourself?
Comment 2 Matthias Ansorg 2020-11-04 12:43:33 UTC
As of ECM 5.75.0, the situation is now superseded as follows. The current master toolchain/Android.cmake file still tells that it requires CMake 3.7:

    # Since we are using CMake Android support, any information from CMake documentation
    # still applies:
    # https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-android
    #
    # .. note::
    #
    #   This module requires CMake 3.7.
    [...]
    cmake_minimum_required(VERSION "3.7")

However, now that file also uses "list(SORT platforms COMPARE NATURAL)" in two lines, which is syntax introduced in CMake 3.18. Compare:

    https://cmake.org/cmake/help/v3.18/command/list.html#ordering
    https://cmake.org/cmake/help/v3.17/command/list.html#ordering

Consequentially, the lines quoted above should be adapted to require CMake 3.18. I'm adapting the issue title accordingly. Note that CMake 3.18 is not yet part of some major distributions (notably, Debian / Ubuntu) – not sure if it's intentional that the latest ECM release 5.75.0 cannot be used there right now.

Since the version requirement bump is a trivial fix, I'd be happy if one of the established contributors would commit a patch. It would take me some time to figure out the correct process and format to propose a patch, as I haven't done that for KDE projects before.
Comment 3 Bug Janitor Service 2020-12-20 14:33:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/63
Comment 4 Jazeix Johnny 2020-12-20 14:36:38 UTC
Git commit 3f466f67e15bb285b7041a0b6b85d72ffb98e059 by Johnny Jazeix.
Committed on 20/12/2020 at 14:32.
Pushed by nicolasfella into branch 'master'.

bump required cmake version for Android.cmake

M  +2    -2    toolchain/Android.cmake

https://invent.kde.org/frameworks/extra-cmake-modules/commit/3f466f67e15bb285b7041a0b6b85d72ffb98e059