CPack: only pack files tracked by git

Viewed 521

I'm trying to understand how to use CPack. I want to produce a binary and a source package. The binary one is perfectly fine, including only what's necessary. In the source distribution, though, there are basically all files present in the project's root directory - including my CMake build directory from where I ran the CPack command.

Since one might have several build directories, I can't see how I can exclude them all from being put into the source package.

set(CPACK_SOURCE_IGNORE_FILES "*.git*") works fine but ideally I would like to restrict the set of included files only to those that are tracked by version control, e.g. git, in the first place. And, no, I don't consider making sure that my project directory is completely clean before a cpack a viable option.

(Packing an entire directory into an archive is something I don't need CPack for.)

1 Answers
Related