Help with CPack for excluding some directories matching...but not all


I need some help. I’ve already asked for CPack help here before, but I find I need more. Namely, I currently have this:


set in my project so I can make tarfiles of source code but not include any build or install or .git directories, etc.

And it works well, until recently a user found an issue. Namely, he didn’t name his build and install directories like build-foo/ and install-foo/ but rather foo-build/ and foo-install/ and he found he was making enormous tarfiles.

Now I could just ban anything with the word “build” in it, say, but my code has ecbuild/ as a subdirectory that I want to capture in the tarfile.

So, I’m wondering, is there anyway to say “exclude all directories with build in the name, but specifically include ecbuild”? My guess from the docs is “probably not”, but maybe the gurus here can help!


Would it be possible to configure the file containing the IGNORE_FILES to include the build directory name explicitly? Or have it include a configured file in some way.

Hmm. Interesting thought. At the moment, my cpack code is in a module pulled in with a simple include() call in the module path, but I suppose I could configure_file() it and then include it from the build directory.