[CMake] CMAKE_INCLUDE_CURRENT_DIR only for out-of-source ?

Alexander Neundorf a.neundorf-work at gmx.net
Tue Mar 21 02:24:46 EST 2006


> Von: Brad King <brad.king at kitware.com> 
>  
> Alexander Neundorf wrote: 
> > Hi,  
> >   
> > in cmLocalGenerator.cxx there's the following code:  
> >   
> > if(!inSource && this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR"))  
> > {  
> >    includeSourceDir = true;  
> >    includeBinaryDir = true;  
> > }  
> >   
> > Why is there the test for !inSource ?  
> >   
> > This means if I have in one directory:  
> >   
> > test1.h  
> > main.c:  
> >   
> > #include <test1.h>  
> > int main()  
> > {  
> > ...  
> > }  
> >   
> > This will work for out-of-source builds, but not for in-source 
> > builds. I would have expected that the CMAKE_INCLUDE_CURRENT_DIR 
> > option also adds  
> > CMAKE_CURRENT_SOURCE_DIR to the include path for in-source builds.  
> > Are there special reasons why not ?  
>  
> The idea of that option was to make *double-quote* includes look the  
> same for in-source and out-of-source builds.  For angle-bracket 
> includes only the explicitly given include path should be used. 
>  
> Note in your example that running just 
>  
>    gcc main.c 
>  
> will not work. 
 
Yes.  
But this means that the only thing this does for us is that we can use 
 
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 
 
instead of  
 
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} 
${CMAKE_CURRENT_BINARY_DIR}) 
 
which isn't *that* much of a help. Also the name 
"CMAKE_INCLUDE_CURRENT_DIR" suggests that then the current dir will be 
part of the include path. But as it is now, this is only true for 
out-of-source builds. 
 
Bye 
Alex 
 

-- 
"Feel free" mit GMX FreeMail!
Monat für Monat 10 FreeSMS inklusive! http://www.gmx.net


More information about the CMake mailing list