[CMake] behaviour of CMAKE_INCLUDE_CURRENT_DIR ?

Brad King brad.king at kitware.com
Wed May 3 10:03:59 EDT 2006


Alexander Neundorf wrote:
> Hi,  
>   
> how does  CMAKE_INCLUDE_CURRENT_DIR behave ? 
>  
> Let's say I do  
> SET(CMAKE_INCLUDE_CURRENT_DIR ON) 
>  
> in my toplevel src/CMakeLists.txt. 
>  
> If a src/sub1/CMakeLists.txt contains 
>  
> add_executable(hello main.cpp) 
>  
> src/sub1/ will be part of the include path. 
>  
>  
> But what happens in the following case: 
>  
> Until now there was 
>  
> # apply for all subdirs 
> include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 
>  
> add_subdirectory(bar1) 
> add_subdirectory(bar2) 
> add_subdirectory(bar3) 
> add_subdirectory(bar4) 
>  
> I guess in this case the include_directories() command has to stay ? 

Yes.  CMAKE_INCLUDE_CURRENT_DIR just adds a target's directory to the 
include path of its source files.

-Brad


More information about the CMake mailing list