[Tarantool-patches] [PATCH luajit 1/2][v2] cmake: set cmake_minimum_required only once

Sergey Bronnikov estetus at gmail.com
Tue Jun 18 15:00:07 MSK 2024


From: Sergey Bronnikov <sergeyb at 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



More information about the Tarantool-patches mailing list