[CMake] order of include dirs

Brad King brad.king at kitware.com
Thu Mar 30 16:23:16 EST 2006


Alexander Neundorf wrote:
>>Von: Brad King <brad.king at kitware.com>  
>>Alexander Neundorf wrote:  
>>>What about the first idea ?   
>>>I think this would fit good to the include_directories() command.   
>>
>>  
>>I think a magic switch that can easily be accidentally inherited by   
>>projects not expecting it will not work well.  
> 
> Maybe.  
> I think the order matters only if there is a file with the same name in  
> several of the include directories.  
> In that case I'd even go so far to say that if foo.h exists in a include  
> dir specified in the top level CMakeLists.txt, but also in a directory  
> which was added explicitely somewhere deeper in the source tree using  
> INCLUDE_DIRECTORIES(), the intention was probably that this file should  
> be prefered, since the include dir was specified more "locally" (which  
> would equal always BEFORE by default).  

Yes, in hindsight it would clearly have been better to make BEFORE the 
default behavior.  However, messing with include directory ordering now 
will potentially break many projects.  This is why I'm waiting until 
include directories are optionally a target-specific property to change 
things.  With the new interface it can be done "right".  For now we need 
to keep the old interface working the same way.

The one-line macro I previously posted resolves the problem.  Even if 
users don't use it they will only have a problem if they repeat KDE's 
header file names.  When they do have a problem it won't take long to 
find the BEFORE fix.

-Brad


More information about the CMake mailing list