Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org,
	Sergey Kaplun <skaplun@tarantool.org>,
	Maxim Kokryashkin <m.kokryashkin@tarantool.org>
Subject: [Tarantool-patches] [PATCH luajit 2/2][v2] cmake: fix warning about minimum required version
Date: Tue, 18 Jun 2024 15:00:09 +0300	[thread overview]
Message-ID: <e4761a664c8f1c233ef2ebdb17f40b73f1f3d766.1718706218.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1718706218.git.sergeyb@tarantool.org>

From: Sergey Bronnikov <sergeyb@tarantool.org>

Since CMake 3.27 compatibility with versions of CMake older than
3.5 is deprecated [1]. CMake produces annoying warning on
configuration stage:

| CMake Deprecation Warning at src/CMakeLists.txt:7 (cmake_minimum_required):
|  Compatibility with CMake < 3.5 will be removed from a future version of
|  CMake.

We cannot bump a minimum required CMake version without bumping
it in the Tarantool build system. However, we can set
a <policy_max> (introduced in CMake 3.12, see [1]) and suppress
a warning. <policy_max> means that this CMake version is known to
work properly and will not result in any build errors rightaway
for higher versions.

Note, that a current CMake minimum required version in Tarantool
is equal to 2.8, but <policy_max> is introduced in CMake 3.12 [1].
However, according to [1] it is not a problem, because if CMake is
"older than 3.12, the extra ... dots will be seen as version
component separators, resulting in the ...<max> part being ignored
and preserving the pre-3.12 behavior of basing policies on <min>".

<policy_max> is set to 3.18 because compatibility with versions
of CMake older than 2.8.12 is deprecated. Calls to
cmake_minimum_required(VERSION) that do not specify at
least 2.8.12 as their policy version (optionally via ...<max>)
will produce a deprecation warning in CMake 3.19 and above [2].
Compatibility with 2.8.12 is needed for CMP0002 [3], see
commit 049e296ee114 ("test: run LuaJIT tests via CMake").

1. https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html
2. https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html#policy-settings
3. https://cmake.org/cmake/help/latest/policy/CMP0002.html
---
 CMakeLists.txt | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09fa172c..f12282c6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,16 @@
 # --- Initial setup ------------------------------------------------------------
 
 # See the rationale below (near LUAJIT_TEST_BINARY variable).
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
+# <policy_max> is set to 3.18 because compatibility with versions
+# of CMake older than 2.8.12 is deprecated. Calls to
+# cmake_minimum_required(VERSION) that do not specify at
+# least 2.8.12 as their policy version (optionally via ...<max>)
+# will produce a deprecation warning in CMake 3.19 and above [1].
+# Compatibility with 2.8.12 is needed for CMP0002 [2].
+#
+# [1] https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html#policy-settings
+# [2] https://cmake.org/cmake/help/latest/policy/CMP0002.html
+cmake_minimum_required(VERSION 3.1...3.18 FATAL_ERROR)
 project(LuaJIT C)
 
 # XXX: Originally CMake machinery is introduced to make LuaJIT
-- 
2.34.1


  parent reply	other threads:[~2024-06-18 12:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 12:00 [Tarantool-patches] [PATCH luajit 0/2][v2] Fix CMake warning Sergey Bronnikov via Tarantool-patches
2024-06-18 12:00 ` [Tarantool-patches] [PATCH luajit 1/2][v2] cmake: set cmake_minimum_required only once Sergey Bronnikov via Tarantool-patches
2024-06-18 12:00 ` Sergey Bronnikov via Tarantool-patches [this message]
2024-06-20  7:02 ` [Tarantool-patches] [PATCH luajit 0/2][v2] Fix CMake warning Sergey Kaplun via Tarantool-patches
2024-07-09  8:06 ` Sergey Kaplun via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4761a664c8f1c233ef2ebdb17f40b73f1f3d766.1718706218.git.sergeyb@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=estetus@gmail.com \
    --cc=m.kokryashkin@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 2/2][v2] cmake: fix warning about minimum required version' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox