On Sat, Apr 4, 2009 at 5:13 AM, elizabeta petreska <
[email protected]> wrote:
> Thanks for the help.I'm sorry if my question was not clear enough or maybe
> I don't understand your answer
>
> My question was how the parent directory may inherit the include
> directories from the child directory (added with add_subdirectory) ?
>
> The current behavior is that the include directories from the child
> directory are added to the list of includes in the parent.
>
Elizabeta,
Provided the directory name is an absolute path I think you could use the
PARENT_SCOPE option to set() to pass the include directories up a directory
to the parent. This is provided you're using CMake >= 2.6.0. If you are on
2.4.x or have to pass variables up many directories there are alternatives
to this that will effectively provide you global variables (was a recent
thread on the mailing list about this).
*parent_dir/CMakeLists.txt:
*add_subdirectory(child_dir)
include_directories(${my_include_dirs})
* child_dir/CMakeLists.txt:
* set(my_include_dirs ${FOO_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/another_child_dir) # can't use relative paths
here
include_directories(${my_include_dirs})
set(my_include_dirs ${my_include_dirs} PARENT_SCOPE)
--
Philip Lowman
_______________________________________________
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