On 4/30/2012 8:37 PM, Raphael Kubo da Costa wrote:
   add_library(foo foo.c)
   set_directory_properties(
       PROPERTIES INCLUDE_DIRECTORIES "${SOME_DIRECTORY}")
[snip]
Is this change of behaviour intentional?

CMake 2.8.8 introduced support for per-target include directories.
Prior to that the directory-level INCLUDE_DIRECTORIES property was
documented as read-only:

$ cmake --help-property INCLUDE_DIRECTORIES
cmake version 2.8.7
  INCLUDE_DIRECTORIES
       List of preprocessor include file search directories.

       This read-only property specifies the list of directories given so far
       to the include_directories command.  It is intended for debugging
       purposes.

It was meant to be set only by the include_directories() command.
The code in question was using previously undefined behavior and
worked only by accident.

CMake 2.8.8 does define behavior but not what the code above
expects.  When a target is first created (e.g. add_library) the
value of the directory-level INCLUDE_DIRECTORIES property is used
to initialize a target-level property of the same name.  After that
direct changes to the INCLUDE_DIRECTORIES property have no effect
on the target.  However, the include_directories() command will
still append to both the directory-level property AND the target
properties for all targets already created in the current dir.

-Brad
--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to