Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Monthly Archives: August 2008

Avoid packing junk with CPack (CMake)

CMake is a new generation build system. Compare to autotools (autoconf, automake):

Its advantage:

  • Extremely faster.
  • Cleaner output. (use make verbose=1 to yield compilation detail)
  • Fewer configuration file to be messed with

Of course, there is no free lunch, the CPack (software packer) is grossly stupid,
for it does not have a good default setting to exclude the redundant files,
such as backup files (~, .bak), CVS/SVN control files, previous tar-ed files,
even the files CMake generates.
In short, it packs every things and junk it finds.

CMake novices will find the size of their packages grow significantly,
as it includes the previous package recursively.

But don’t worry, there is always a way to avoid the situation.
Following example demonstrates how to avoid some usual “junk” files:


SET(COMMON_IGNORE_FILES '/CMakeFiles/' '/.svn/' '_CPack_Packages/' 
    '.cmake$' '~' '.swp' '.log' '.gz' '.directory$' 'CMakeCache.txt')