[CMake] Re: CPack: how to ignore some file in source tree?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Oct 12 19:54:59 EDT 2006


On 2006-10-13 01:13+0200 Eric Noulard wrote:

> Ok I found that I may set
> CPACK_SOURCE_IGNORE_FILES
> I did had it to Wiki:
> http://www.cmake.org/Wiki/CMake:Packaging_With_CPack#CPack_Settings
>
> But now I would only like to ignore "more" file
> not replacing the default ignore list.

You can specify any set or regular expressions you like to ignore files. For
example, here is part of a set of regex's that we currently use with the
PLplot project:

# The following components are regex's to match anywhere (unless anchored)
# in absolute path + filename to find files or directories to be excluded
# from source tarball.
set(CPACK_SOURCE_IGNORE_FILES
"Makefile\\\\.in$"
"~$"
"^${PROJECT_SOURCE_DIR}.*/CVS/"
"^${PROJECT_SOURCE_DIR}/debian/"
"^${PROJECT_SOURCE_DIR}/old/"
)

These patterns ignore all Makefile.in files, all files with names that end
with tilde ("~"), all files in all CVS directories in the source tree, and
all files in our top-level "debian" and "old" directories in the source
tree.

Note the use of the anchor characters ("^" and "$") in the regex's to be
completely definite about what patterns you are ignoring in the absolute
path+filename. Also, when you anchor at the start of the absolute
path+filename with "^" you obviously have to follow that anchor with
${PROJECT_SOURCE_DIR} to specify the top-level source tree.

I last checked the above patterns worked for cmake-2.4.2.  At least for that
version, regex escapes have to be four backward slashes in a row (as in the
first pattern so that the "." is part of the filename rather than the usual
regex interpretation of any character).  Also, (I presume because CMake
variables are evaluated right away) you do not have to escape the "$" that
appears in variable names such as ${PROJECT_SOURCE_DIR}.  Note, I haven't
yet checked the above patterns work for cmake-2.4.3.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list