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$"
    "/src/config.h$")

SET(PRJ_COMMON_IGNORE_FILES ${COMMON_IGNORE_FILES} 
   <PROJECT_SPECIFIC_IGNORE_FILES_PATTERN> )

SET(CPACK_SOURCE_IGNORE_FILES ${PRJ_COMMON_IGNORE_FILES}
   <PROJECT_SPECIFIC_IGNORE_FILES_PATTERN> )

SET(CPACK_PACKAGE_IGNORE_FILES ${PRJ_COMMON_IGNORE_FILES} 
<FILES_PATTERN_THAT_YOU_DONT_WANT_TO_PUT_IN_BINARY_TARBALL> )

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