From 5ea06b13fe4f1f405419b12cb14c95a4439c369c Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 16 Jun 2026 07:03:37 +0200 Subject: [PATCH] Exclude the build tree from the source package The .gitignore-derived `build/` pattern does not actually prune the build directory or its contents from the CPack source package, so an empty build/ (and, once docs were built in CI, build/doc-html) leaked into the zip. Ignore the whole build tree in CPACK_SOURCE_IGNORE_FILES. --- .github/workflows/release.yml | 6 +++--- CMakeLists.txt | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 773892fc..d694d96c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,9 +76,9 @@ jobs: - name: Build source zip via CPack id: build - # Configure first so the doc target picks up doxygen/mkdocs, build the - # docs, then stage the generated site into the source tree so the CPack - # source package (which packages the source dir) includes doc-html/. + # Build the docs and stage the rendered site at the top level so the + # CPack source package includes doc-html/. The build/ tree itself is + # excluded by CPACK_SOURCE_IGNORE_FILES. run: | cmake -B build . cmake --build build --target doc diff --git a/CMakeLists.txt b/CMakeLists.txt index 1045f3ee..ee568cec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -582,7 +582,9 @@ if (FMT_MASTER_PROJECT AND EXISTS ${gitignore}) string(REPLACE "*" ".*" line "${line}") set(ignored_files ${ignored_files} "${line}$" "${line}/") endforeach () - set(ignored_files ${ignored_files} /.git /build/doxyxml .vagrant) + # Exclude the whole build tree: the .gitignore-derived `build/` pattern does + # not actually prune the directory or its contents from the source package. + set(ignored_files ${ignored_files} /.git "/build($|/)" .vagrant) set(CPACK_SOURCE_GENERATOR ZIP) set(CPACK_SOURCE_IGNORE_FILES ${ignored_files})