From Fedora Project Wiki

CPack is cross-platform software packaging tool distributed with CMake It uses the generators concept from CMake, to abstract package generation on specific platforms, and it can be used with or without CMake. Nevertheless, only the issues from CPack with CMake is discussed.

By default, CPack packs everything it found from the working directory. Unfortunately, this includes junks such as backup files ( *~ *.bak *.swp from vim), version control information (.svn/, CVS/). Novice package maintainers will even find out that the size of their packages increase dramatically, as it also packs the previous tarball.

In order to avoid packing junks, use following command to avoid the known file pattern.

SET(COMMON_IGNORE_FILES "/CMakeFiles/" "_CPack_Packages/" "/Testing/"
    ".cmake$"   ".directory$" "CMakeCache.txt"
    "/.svn/"  "/CVS/" "~$" ".swp$" ".log$" ".gz$"




Note that COMMON_IGNORE_FILES and PRJ_COMMON_IGNORE_FILES are not built-in CPack environment variables, use any name you wish.