Hi,

On Fri, Jun 8, 2012 at 3:14 AM, Robert Dailey <[email protected]>wrote:

> I think I might know what it is...
>
> I do the following:
>
> include_directories( Z )
> add_library( A )
> include_directories( A ) # Include "A"'s include directory
> add_library(B) # B depends on A, and thus includes its header directory
>
> My assumption was that, at configuration time, a snapshot of the current
> include directories is taken and used, so thus any further ones that are
> added will not affect previously created targets in the same directory.
> However, apparently directory properties are processed at generation time,
> so this is why I'm seeing this behavior.
>
> Can anyone confirm?
>

Basically yes. I don't actually know the internals of CMake but from what I
understood, include_directories is executed during the configuration phase
and sets a directory-property. The creation of the Makefile/VS
file/whatever is done later and simply reads this directory property. So
all targets in a directory will use the same include dirs.

Luckily in 2.8.8 CMake gained the ability to set include-directories per
target, so you can achieve what
you want if you run require 2.8.8 and set the INCLUDE_DIRECTORIES target
property.

Andreas
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to