[cmake-developers] Patch to only consider build dependencies between files in the source directory

Attila Krasznahorkay attila.krasznahorkay at gmail.com
Fri Mar 18 11:52:14 EDT 2016


Hi Brad,

>> +      // If it's an absolute path, check if it starts with the source
>> +      // direcotory:
>> +      return ( ( path.find( SourceDir ) != 0 ) &&
>> +               ( path.find( BinaryDir ) != 0 ) );
> 
> Please look at using strncmp and a check that the following character
> is a nul terminator or '/'.  Otherwise an external location with
> a common prefix may be mistaken for part of the project.

Not sure what scenario you have in mind here. :-/ std::string::find should only return 0 if the source directory path or binary directory path is what the evaluated path begins with. Why should we worry what the path continues with?

I was wondering about possibly using strncmp, but thought that performance-wise std::string::find should be fine as well here.

I'm not at all against changing the code, I just don't understand yet what setup the current code would not handle correctly.

> Also please add documentation in a
> 
>  Help/variable/CMAKE_DEPENDS_IN_PROJECT_ONLY.rst
> 
> file and update Help/manual/cmake-variables.7.rst to reference it.

Will do. Was just not sure where to add this documentation.

Cheers,
            Attila


More information about the cmake-developers mailing list