This is an automated email from the ASF dual-hosted git repository.

tuhaihe pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/main by this push:
     new 15d75c672ad Fix diskquota build on CMake 3.16
15d75c672ad is described below

commit 15d75c672ad360a11f1b7204218a35c016479f0c
Author: Dianjin Wang <[email protected]>
AuthorDate: Tue Sep 8 17:10:27 2026 +0800

    Fix diskquota build on CMake 3.16
    
    diskquota is the only component in the tree that requires a CMake
    newer than 3.16, so building with --with-diskquota fails on distros
    whose default CMake is older. On Ubuntu 20.04 (CMake 3.16.3) the
    build stops at:
    
      CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
        CMake 3.20 or higher is required.  You are running version 3.16.3
      make[1]: *** [Makefile:52: all-diskquota-recurse] Error 2
    
    Every other first-party CMakeLists in the tree already declares 3.12
    or lower, so lowering diskquota's two declarations to 3.16 brings it
    in line with the rest and does not raise the bar anywhere else.
    
    Neither declaration needed to be as high as it was:
    
    * CMakeLists.txt claimed 3.20 for cmake_path, but cmake_path is never
      called anywhere in the diskquota tree. The comment was stale.
    
    * cmake/Regress.cmake claimed 3.17 for CMAKE_CURRENT_FUNCTION_LIST_DIR,
      which is used to locate regress_loop.sh and regress_show_diff.sh.
      That variable is replaced with REGRESS_CMAKE_LIST_DIR, captured from
      CMAKE_CURRENT_LIST_DIR when the module is included, which resolves
      to the same directory and is available in every supported CMake.
      Lowering the version alone would not have been enough: on 3.16
      CMAKE_CURRENT_FUNCTION_LIST_DIR expands to an empty string without
      error, so the extension would still compile while installcheck
      silently pointed at /regress_loop.sh.
    
    One optional code path, guarded by DISKQUOTA_LAST_RELEASE_PATH, calls
    file(ARCHIVE_EXTRACT) and so still needs CMake 3.18. The in-tree build
    never sets that variable; a comment now records the requirement.
    
    Assisted-by: Claude Code
---
 gpcontrib/diskquota/CMakeLists.txt      |  6 ++++--
 gpcontrib/diskquota/cmake/Regress.cmake | 11 +++++++----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/gpcontrib/diskquota/CMakeLists.txt 
b/gpcontrib/diskquota/CMakeLists.txt
index face48578a6..55d50966880 100644
--- a/gpcontrib/diskquota/CMakeLists.txt
+++ b/gpcontrib/diskquota/CMakeLists.txt
@@ -1,5 +1,4 @@
-cmake_minimum_required(VERSION 3.20)
-# cmake_path requires 3.20
+cmake_minimum_required(VERSION 3.16)
 
 project(diskquota)
 
@@ -90,6 +89,9 @@ TARGET_LINK_LIBRARIES(diskquota ${PG_LIB_DIR}/libpq.so)
 # packing part, move to a separate file if this part is too large
 include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Distro.cmake)
 
+# NOTE: file(ARCHIVE_EXTRACT) below requires CMake 3.18. This branch is only
+# taken when DISKQUOTA_LAST_RELEASE_PATH is set explicitly, which the in-tree
+# build never does, so it does not affect the 3.16 minimum declared above.
 if(DEFINED DISKQUOTA_LAST_RELEASE_PATH)
   message(STATUS "Copy pervious installer from ${DISKQUOTA_LAST_RELEASE_PATH}")
   file(ARCHIVE_EXTRACT INPUT ${DISKQUOTA_LAST_RELEASE_PATH} PATTERNS "*.so")
diff --git a/gpcontrib/diskquota/cmake/Regress.cmake 
b/gpcontrib/diskquota/cmake/Regress.cmake
index 9f823e4d998..72162edf16d 100644
--- a/gpcontrib/diskquota/cmake/Regress.cmake
+++ b/gpcontrib/diskquota/cmake/Regress.cmake
@@ -40,8 +40,11 @@
 #    SQL_DIR sql
 #    EXPECTED_DIR expected_${GP_MAJOR_VERSION})
 
-# CMAKE_CURRENT_FUNCTION_LIST_DIR - 3.17
-cmake_minimum_required(VERSION 3.17)
+cmake_minimum_required(VERSION 3.16)
+
+# Directory holding this module, captured at include() time. Used instead of
+# CMAKE_CURRENT_FUNCTION_LIST_DIR, which requires CMake 3.17.
+set(REGRESS_CMAKE_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
 
 # pg_isolation2_regress was not shipped with GPDB release. It needs to be 
created from source.
 function(_PGIsolation2Target_Add working_DIR)
@@ -203,7 +206,7 @@ function(RegressTarget_Add name)
         ${regress_BIN}  ${regress_opts_arg}  ${regress_arg})
     if (arg_RUN_TIMES)
         set(test_command
-            ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/regress_loop.sh
+            ${REGRESS_CMAKE_LIST_DIR}/regress_loop.sh
             ${arg_RUN_TIMES}
             ${regress_command})
     else()
@@ -222,7 +225,7 @@ function(RegressTarget_Add name)
         COMMAND
         ${test_command}
         ||
-        ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/regress_show_diff.sh ${working_DIR}
+        ${REGRESS_CMAKE_LIST_DIR}/regress_show_diff.sh ${working_DIR}
     )
 
     if(arg_REGRESS_TYPE STREQUAL isolation2)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to