[cmake-developers] Patch to only consider build dependencies between files in the source directory
Attila Krasznahorkay
attila.krasznahorkay at gmail.com
Wed Mar 16 03:42:21 EDT 2016
Hi Brad,
All valid points. Will try to make a new patch today.
Cheers,
Attila
> On 15 Mar 2016, at 19:13, Brad King <brad.king at kitware.com> wrote:
>
> On 03/15/2016 10:48 AM, Attila Krasznahorkay wrote:
>> https://cmake.org/pipermail/cmake-developers/2015-December/027197.html
>>
>> With the following patch, when setting the CMAKE_ONLY_IN_SOURCE_DEPENDENCIES
>> variable to 1/ON/TRUE, this file size goes down to just a few kilobytes.
>> Speeding up our build noticeably.
>
> Thanks. As Ben pointed out in the original thread the build tree should
> be included as well. Perhaps a name like
>
> CMAKE_DEPENDS_IN_PROJECT_ONLY
>
> could be used to indicate that it includes only dependencies in the project
> directories (source or build tree).
>
>> As far as I can see, the "cmake -E cmake_depends" call is only used by
>> the Makefile generator at the moment. So I only taught that generator
>> about this new variable.
>
> The Makefile generator is the only one for which CMake takes responsibility
> for implicit dependency scanning.
>
>> I just didn't see what I should do in the Ninja generator for instance
>> to apply this setting. Even though I would be very interested in implementing
>> the feature in that generator as well.
>
> The Ninja generator uses the compiler's information about dependencies
> as generated by options like `gcc -MD`. Since that occurs along with
> the compilation there is little cost to including all dependencies
> except for stat during rebuilds. See discussion here:
>
> https://cmake.org/Bug/view.php?id=14914
>
> about the opposite use case (including system dependencies instead of
> excluding them).
>
>> + infoFileStream
>> + << "set(CMAKE_ONLY_IN_SOURCE_DEPENDENCIES "
>> + << ( this->Makefile->IsOn( "CMAKE_ONLY_IN_SOURCE_DEPENDENCIES" ) ?
>> + "1" : "0" )
>> + << ")\n";
>
> Rather than communicating this to the dependency scanning step and
> doing the filtering there, please look at applying the filter during
> generation of CMAKE_<LANG>_TARGET_INCLUDE_PATH.
>
> Thanks,
> -Brad
>
More information about the cmake-developers
mailing list