[CMake] dependencies in depend.make

Daniel daniel at connect2.com
Sun May 4 20:40:32 EDT 2008


Bill Hoffman wrote:
> Daniel wrote:
>> One thing I have noticed while trying to improve the speed of my builds is
>> that the depends.make file for a project is fairly large (15MB) and that
>> most of that size is dependencies against libraries I am using, mostly
>> Boost and Qt.
>> 
>> It is fairly safe to assume that I won't be modifying these libraries, 
>> would removing these dependencies speed up my builds, and if so is there a
>> way to tell cmake not to bother checking to see if certain directories have
>> changed?
> 
> 
> You can use INCLUDE_REGULAR_EXPRESSION directory property.  You will need to
> come up with a regular expression that excludes Qt and Boost, but keeps your
> stuff.
> 
> -Bill
> 
> 
I added a regex that excludes boost, and my builds have gone from 10m0s to
8m17s!  This gain was probably magnified since my laptop has such a slow hard 
drive, but it is still very significant.

I had a few problems getting it working at first, the documentation does not
make it clear what exactly I am designing a regex for, at first I thought it was
for the absolute path of the file, then tried the quoted include "foo.h", and
finally found that it is really just foo.h. I think the documentation for this
command should be improved, I can file a bug for it if you would like.

It's also pretty hard to come up with a regex that trims out all of my
libraries. It seems like it would be far easier to design an EXCLUDE regex. My
boost includes look like <boost/whatever.h> so I ended up using
"^[^b][^o][^o][^s][^t].*$", but I would also like to exclude anything that
starts with "Qt", and I don't see how I can specify both without using negative
lookbehinds. If there were an exclude regex, you could simply use "^(boost|Qt)".

Perhaps it would also be better to trim later in the process, after we know the
absolute path to the files, this would make it very easy to write an exclude for
/usr/include, but it seems like the extra work cmake would have to do this way
might cancel the savings. Another thing we could do is to keep the "" or <>
around the includes, this way you could easily trim all <> includes from the
dependencies.

After writing all of this I believe the best thing to do is to add an
EXCLUDE_REGULAR_EXPRESSION command and also to pull the "" or <> into this
string that is matched by this command. Anything excluded would take precedence
over anything included. If I wrote a patch that did this would it be considered
for version 2.8?
--
Daniel


More information about the CMake mailing list