* [Tarantool-patches] [PATCH luajit 1/2][v2] cmake: set cmake_minimum_required only once
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 ` Sergey Bronnikov via Tarantool-patches
2024-06-18 12:00 ` [Tarantool-patches] [PATCH luajit 2/2][v2] cmake: fix warning about minimum required version Sergey Bronnikov via Tarantool-patches
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2024-06-18 12:00 UTC (permalink / raw)
To: tarantool-patches, Sergey Kaplun, Maxim Kokryashkin
From: Sergey Bronnikov <sergeyb@tarantool.org>
The commit 049e296ee114 ("test: run LuaJIT tests via CMake")
introduced CMake build infrastructure and added
`cmake_minimum_required` to each CMakeLists.txt in the project.
However, it is not required, single `cmake_minimum_required`
specified in a root CMakeLists.txt is more than enough.
The patch left `cmake_minimum_required` in a root CMakeLists.txt
and removes in other CMakeLists.txt below in a source tree.
---
CMakeLists.txt | 2 --
etc/CMakeLists.txt | 3 ---
src/CMakeLists.txt | 3 ---
src/host/CMakeLists.txt | 3 ---
test/CMakeLists.txt | 3 ---
test/LuaJIT-tests/CMakeLists.txt | 3 ---
test/LuaJIT-tests/src/CMakeLists.txt | 3 ---
test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt | 3 ---
test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt | 3 ---
test/lua-Harness-tests/CMakeLists.txt | 3 ---
test/tarantool-tests/CMakeLists.txt | 3 ---
tools/CMakeLists.txt | 3 ---
12 files changed, 35 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2355ce17..09fa172c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -339,8 +339,6 @@ option(LUAJIT_USE_TEST "Generate <test> target" ON)
# As a result the minimal required CMake version is set to 3.1.
# For more info, see CMake Release notes for 3.1 version.
# https://cmake.org/cmake/help/latest/release/3.1.html#commands
-# XXX: This option is moved below source tree processing since
-# the default binary target need to be generated.
set(LUAJIT_TEST_BINARY ${LUAJIT_BINARY} CACHE STRING
"Lua implementation to be used for tests. Default is 'luajit'."
)
diff --git a/etc/CMakeLists.txt b/etc/CMakeLists.txt
index d54fa794..7715c3fa 100644
--- a/etc/CMakeLists.txt
+++ b/etc/CMakeLists.txt
@@ -1,8 +1,5 @@
# Building supplementary materials for LuaJIT.
-# See the rationale in the root CMakeLists.txt.
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
set(LUAJIT_PC_PREFIX ${CMAKE_INSTALL_PREFIX})
if(CMAKE_LIBRARY_ARCHITECTURE)
set(LUAJIT_PC_MULTILIB "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 03338306..b104264e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,9 +3,6 @@
# Copyright (C) 2020-2021 LuaVela Authors.
# Copyright (C) 2015-2020 IPONWEB Ltd.
-# See the rationale in the root CMakeLists.txt.
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
enable_language(ASM)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt
index 1ce3e224..83b4658b 100644
--- a/src/host/CMakeLists.txt
+++ b/src/host/CMakeLists.txt
@@ -1,8 +1,5 @@
# Building the toolchain for LuaJIT VM preprocessing.
-# See the rationale in the root CMakeLists.txt.
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
# FIXME: Both minilua and buildvm need to be build with the HOST_*
# toolchain.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 19726f5a..0db2dd8b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,8 +1,5 @@
# Running various test suites against LuaJIT.
-# See the rationale in the root CMakeLists.txt.
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
include(MakeLuaPath)
find_program(LUACHECK luacheck)
diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt
index b8e4dfc4..c8a82a6b 100644
--- a/test/LuaJIT-tests/CMakeLists.txt
+++ b/test/LuaJIT-tests/CMakeLists.txt
@@ -1,6 +1,3 @@
-# See the rationale in the root CMakeLists.txt
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
add_subdirectory(src)
make_lua_path(LUA_CPATH
diff --git a/test/LuaJIT-tests/src/CMakeLists.txt b/test/LuaJIT-tests/src/CMakeLists.txt
index 2f90da86..00e58b80 100644
--- a/test/LuaJIT-tests/src/CMakeLists.txt
+++ b/test/LuaJIT-tests/src/CMakeLists.txt
@@ -1,6 +1,3 @@
-# See the rationale in the root CMakeLists.txt.
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
# Use `lib` prefix for loading via FFI and `require()`.
AddTestLib(libctest libctest.c)
enable_language(CXX)
diff --git a/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt b/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt
index 0942c62d..30054206 100644
--- a/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt
+++ b/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt
@@ -1,9 +1,6 @@
# Test suite that has been added from PUC-Rio Lua 5.1 test archive
# in scope of https://github.com/tarantool/tarantool/issues/5845.
-# See the rationale in the root CMakeLists.txt.
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
# XXX: There are two ways to set up the proper environment
# described in the suite's README:
# * set LUA_PATH to "?;./?.lua"
diff --git a/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt b/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt
index b496cbab..d4eb365a 100644
--- a/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt
+++ b/test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt
@@ -1,9 +1,6 @@
# Test suite that has been added from PUC-Rio Lua 5.1 test archive
# in scope of https://github.com/tarantool/tarantool/issues/5845.
-# See the rationale in the root CMakeLists.txt.
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
# Build additional C libraries for tests.
AddTestLib(lib1 lib1.c)
AddTestLib(lib11 lib1.c lib11.c)
diff --git a/test/lua-Harness-tests/CMakeLists.txt b/test/lua-Harness-tests/CMakeLists.txt
index 8dea30b7..526d9824 100644
--- a/test/lua-Harness-tests/CMakeLists.txt
+++ b/test/lua-Harness-tests/CMakeLists.txt
@@ -1,9 +1,6 @@
# Test suite that has been added from lua-Harness test suite
# in scope of https://github.com/tarantool/tarantool/issues/5844.
-# See the rationale in the root CMakeLists.txt
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
# Tests create temporary files (see 303-package.t and 411-luajit.t
# for example) to be required. Also, they require some files from
# the original test source directory.
diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/CMakeLists.txt
index 56660932..fd6cecec 100644
--- a/test/tarantool-tests/CMakeLists.txt
+++ b/test/tarantool-tests/CMakeLists.txt
@@ -1,9 +1,6 @@
# Test suite that has been moved from Tarantool repository in
# scope of https://github.com/tarantool/tarantool/issues/4478.
-# See the rationale in the root CMakeLists.txt.
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
add_custom_target(tarantool-tests-libs
DEPENDS libluajit
)
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 695c079a..f8e1ab3b 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -3,9 +3,6 @@
# Copyright (C) 2020-2021 LuaVela Authors.
# Copyright (C) 2015-2020 IPONWEB Ltd.
-# See the rationale in the root CMakeLists.txt.
-cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
-
set(LUAJIT_TOOLS_DEPS)
if(LUAJIT_DISABLE_MEMPROF)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Tarantool-patches] [PATCH luajit 2/2][v2] cmake: fix warning about minimum required version
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
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
3 siblings, 0 replies; 5+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2024-06-18 12:00 UTC (permalink / raw)
To: tarantool-patches, Sergey Kaplun, Maxim Kokryashkin
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
^ permalink raw reply [flat|nested] 5+ messages in thread