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.
This commit is contained in:
Victor Zverovich
2026-06-16 07:03:37 +02:00
parent 11ddbcb789
commit 5ea06b13fe
2 changed files with 6 additions and 4 deletions
+3 -3
View File
@@ -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
+3 -1
View File
@@ -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})