From cdde70c6b1284149e4958606a6e452ae9eaf3976 Mon Sep 17 00:00:00 2001 From: crueter Date: Sun, 1 Nov 2026 13:42:44 -0500 Subject: [PATCH 1/2] [cmake] Disable ZSTD_BUILD_PROGRAMS when zstd is a subproject e.g. vendoring, no need to add these executables. Signed-off-by: crueter --- CMakeLists.txt | 10 ++++++++++ build/cmake/CMakeModules/ZstdOptions.cmake | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10fef39b909..2a764731dd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,15 @@ cmake_minimum_required(VERSION 3.10) +# Determine if zstd is built as a subproject (using add_subdirectory) or if it +# is the master project. +if (NOT DEFINED ZSTD_MASTER_PROJECT) + set(ZSTD_MASTER_PROJECT OFF) + # Checking project name is more reliable than checking source directories. + if (NOT DEFINED PROJECT_NAME) + set(ZSTD_MASTER_PROJECT ON) + endif () +endif () + # Thin wrapper so `cmake -S .` behaves like `cmake -S build/cmake`. # Policy lives in build/cmake; keep parent project language-less. project(zstd-superbuild LANGUAGES NONE) diff --git a/build/cmake/CMakeModules/ZstdOptions.cmake b/build/cmake/CMakeModules/ZstdOptions.cmake index dc7813444e2..aaef1e0dba7 100644 --- a/build/cmake/CMakeModules/ZstdOptions.cmake +++ b/build/cmake/CMakeModules/ZstdOptions.cmake @@ -41,7 +41,7 @@ else() endif() # Build component options -option(ZSTD_BUILD_PROGRAMS "Build command-line programs" ON) +option(ZSTD_BUILD_PROGRAMS "Build command-line programs" ${ZSTD_MASTER_PROJECT}) option(ZSTD_BUILD_CONTRIB "Build contrib utilities" OFF) option(ZSTD_PROGRAMS_LINK_SHARED "Link programs against shared library" OFF) From 1330632747674f42b567444d296dbe6492cf2a4d Mon Sep 17 00:00:00 2001 From: crueter Date: Sun, 1 Nov 2026 13:47:10 -0500 Subject: [PATCH 2/2] Formatting Signed-off-by: crueter --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a764731dd9..07abab6b747 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,12 @@ cmake_minimum_required(VERSION 3.10) # Determine if zstd is built as a subproject (using add_subdirectory) or if it # is the master project. if (NOT DEFINED ZSTD_MASTER_PROJECT) - set(ZSTD_MASTER_PROJECT OFF) - # Checking project name is more reliable than checking source directories. - if (NOT DEFINED PROJECT_NAME) - set(ZSTD_MASTER_PROJECT ON) - endif () -endif () + set(ZSTD_MASTER_PROJECT OFF) + # Checking project name is more reliable than checking source directories. + if (NOT DEFINED PROJECT_NAME) + set(ZSTD_MASTER_PROJECT ON) + endif() +endif() # Thin wrapper so `cmake -S .` behaves like `cmake -S build/cmake`. # Policy lives in build/cmake; keep parent project language-less.