Help with CPack ignore regex


I’m hoping for some help here. We recently found that we need to add some extra files to our CPACK_SOURCE_IGNORE_FILES and, well, I need help. I currently have:


but I’d like to add more now. For example, I’d like to ignore any *.swp files in any directory or that vim would make or maybe *~ files from emacs.

So went to a subdirectory and did:

cp CMakeLists.txt CMakeLists.txt.swp

to create a dummy file and tried adding:


but I got:

RegularExpression::compile(): ?+* follows nothing.
RegularExpression::compile(): Error in compile.

So, I look around the web and see that I maybe should use:


and that does compile…but doesn’t seem to do what I want as the test CMakeLists.txt.swp file I made is still in the tarfile made by CPack.

So what is the right way to figure out these regexes?


Wouldn’t it make more sense to give CPack the ability to honor .git-ignore files?

Or use git to pack the source?

Also using CPack to package sources is quite inefficient as it copies to another directory first instead of directly into the archive.

This looks like glob, not a regex. Maybe you wan’t .*\.swp, instead.