[CMake] CMAKE_INCLUDE_CURRENT_DIR?

Kishore, Jonnalagadda (IE10) Kishore.Jonnalagadda at honeywell.com
Fri Mar 16 08:51:18 EST 2007


> -----Original Message-----
> From: cmake-bounces+kishore.jonnalagadda=honeywell.com at cmake.org
> [mailto:cmake-bounces+kishore.jonnalagadda=honeywell.com at cmake.org] On
> Behalf Of Filipe Sousa
> Sent: Friday, March 16, 2007 2:33 AM
> To: cmake at cmake.org
> Subject: Re: [CMake] CMAKE_INCLUDE_CURRENT_DIR?
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Kishore, Jonnalagadda (IE10) wrote:
> > Can someone explain to me the use of CMAKE_INCLUDE_CURRENT_DIR?
> >
> > In the root CMakeLists.txt file of my project I tried setting the
> > variable to ON (tried 1 as well) with:
> >
> > SET(CMAKE_INCLUDE_CURRENT_DIR ON)
> >
> > This seemed to make no difference. My expectation reading
> > http://www.cmake.org/Wiki/CMake_Useful_Variables was that all the
sub
> > directories included with the command ADD_SUBDIRECTORY() get
included as
> > part of include directories for include files located elsewhere.
> 
> CMAKE_INCLUDE_CURRENT_DIR is the same as
> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}
> ${CMAKE_CURRENT_SOURCE_DIR}) for all targets.
> 
> If you have a project that constantly needs to add the current source
> directory and the current binary directory to the targets you can set
> CMAKE_INCLUDE_CURRENT_DIR.

Thanks for your reply. I did read the wiki that basically said the same
thing. But then, despite setting the value I had to put in
INCLUDE_DIRECTORIES(.)

Let us say in the root folder I have two files 'config.h' and
'CMakeLists.txt' and a folder called 'src'

CMakeLists.txt contains

ADD_SUBDIRECTORY(src)
PROJECT(test)
ADD_EXECUTABLE(test ${SRCS})

The directory 'src' contains 'CMakeLists.txt' and 'main.c' which contain

CMakeLists.txt:

SET(SRCS ${CMAKE_CURRENT_SOURCE_DIR}/main.c
	CACHE
	INTERNAL
	" source files"
	FORCE)

main.c:

include "config.h"
main()
{}




More information about the CMake mailing list