From ddb23f3a0223d1280bd674ea7fe4b1dedde22997 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Fri, 24 Jul 2026 15:29:13 +0200 Subject: [PATCH] tools/cmake: pass -DBUILD_TESTING=OFF to bootstrap Instead of carrying 100-no-testing.patch, pass -DBUILD_TESTING=OFF directly to CMake's bootstrap script. This avoids refreshing the patch on every CMake update. The patch also changed the default in the installed CTest.cmake module. Preserve that behavior by passing -DBUILD_TESTING=OFF by default in cmake.mk for target and host builds. Packages can override it via CMAKE_OPTIONS or CMAKE_HOST_OPTIONS. OpenWrt never runs CMake tests, so building them only wastes build time. This replaces the patch introduced in 8af80e79bd5b ("tools/cmake: update to 3.17.0"). Signed-off-by: Josef Schlehofer Link: https://github.com/openwrt/openwrt/pull/24403 Signed-off-by: Robert Marko --- include/cmake.mk | 2 ++ tools/cmake/Makefile | 3 ++- tools/cmake/patches/100-no-testing.patch | 33 ------------------------ 3 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 tools/cmake/patches/100-no-testing.patch diff --git a/include/cmake.mk b/include/cmake.mk index 29c5aacb831..96332b3b3de 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -127,6 +127,7 @@ define Build/Configure/Default -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE \ -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE \ -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=TRUE \ + -DBUILD_TESTING=OFF \ $(CMAKE_OPTIONS) \ $(CMAKE_SOURCE_DIR) \ ) @@ -175,6 +176,7 @@ define Host/Configure/Default -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE \ -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=TRUE \ -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_TESTING=OFF \ $(CMAKE_HOST_OPTIONS) \ $(HOST_CMAKE_SOURCE_DIR) \ ) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index b70507baed8..0ab72afd155 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -37,7 +37,8 @@ HOST_CONFIGURE_ARGS := \ --system-liblzma \ --system-zlib \ --system-zstd \ - --generator=Ninja + --generator=Ninja \ + -- -DBUILD_TESTING=OFF CMAKE_HOST_OPTIONS = \ -DZSTD_INCLUDE_DIR="$(STAGING_DIR_HOST)/include" \ diff --git a/tools/cmake/patches/100-no-testing.patch b/tools/cmake/patches/100-no-testing.patch deleted file mode 100644 index ae3bba6b74f..00000000000 --- a/tools/cmake/patches/100-no-testing.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/Modules/CTest.cmake -+++ b/Modules/CTest.cmake -@@ -60,7 +60,7 @@ the :variable:`CTEST_USE_LAUNCHERS` vari - in the ``CTestConfig.cmake`` file. - #]=======================================================================] - --option(BUILD_TESTING "Build the testing tree." ON) -+option(BUILD_TESTING "Build the testing tree." OFF) - - # function to turn generator name into a version string - # like vs9 or vs10 ---- a/Modules/Dart.cmake -+++ b/Modules/Dart.cmake -@@ -46,7 +46,7 @@ if(cmp0145 STREQUAL "") - cmake_policy(ISSUE_WARNING CMP0145) - endif() - --option(BUILD_TESTING "Build the testing tree." ON) -+option(BUILD_TESTING "Build the testing tree." OFF) - - if(BUILD_TESTING) - # We only get here if a project already ran include(Dart), ---- a/Tests/Contracts/VTK/Dashboard.cmake.in -+++ b/Tests/Contracts/VTK/Dashboard.cmake.in -@@ -25,7 +25,7 @@ ctest_empty_binary_directory(${CTEST_BIN - - file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " - VTK_BUILD_EXAMPLES:BOOL=ON -- VTK_BUILD_TESTING:STRING=WANT -+ VTK_BUILD_TESTING:STRING=OFF - VTK_WRAP_PYTHON:BOOL=ON - ExternalData_OBJECT_STORES:FILEPATH=@base_dir@/ExternalData - ")