[CMake] Behavior of include_directories()
Miguel A. Figueroa-Villanueva
miguelf at ieee.org
Sat Jan 17 12:45:35 EST 2009
On Sat, Jan 17, 2009 at 12:22 PM, Robert Dailey wrote:
> On Fri, Jan 16, 2009 at 5:51 PM, Robert Dailey wrote:
>> I'm reading the documentation about include directories (located here) and
>> I do not see any mention of include directories being specific to the target
>> or more of a global thing. However, when looking at the output of my visual
>> studio project files, it seems to only have those include directories added
>> when called after calling project(). It seems like each time I call
>> project() it resets the previously added include directories. Is this
>> behavior intended? I would actually prefer a case where include directories
>> were global and each time you call include_directories() they are appended.
>
> With a little bit of hard work I was able to figure out how
> include_directories() works. The documentation was not very specific on this
> detail. It appears the include directories are a property of the containing
> directory of the current CMakeLists.txt file.
CMake traverses the directory structure as defined by add_subdirectory
commands. Directories added with the add_subdirectory command are
children of the directory where the command was called.
include_directories will append the listed directories to the search
path of the targets in that CMakeLists.txt and all the targets in
CMakeLists.txt of child nodes.
--Miguel
More information about the CMake
mailing list