[cmake-developers] [CMake] target_include_directories target issue

Daniel Pfeifer daniel at pfeifer-mail.de
Mon Nov 17 14:09:55 EST 2014


FWD to developers list. I think this is a documentation issue.

Luis Felipe Dominguez Vega <lfdominguez at estudiantes.uci.cu> schrieb am Mon
Nov 17 2014 at 5:42:55 PM:

> I can't see into the source code of cmake, into the
> cmTargetIncludeDirectoriesCommand.cxx somethink like import the
> INCLUDE_DIRECTORIES from target passed to target_include_directories, may
> an
> error in the documentation?
> -----------------------------------------------------------
> On Sunday 16 November 2014 11:56:05 AM Wojciech Mamrak wrote:
> > Hello,
> >
> > the docs claim:
> >
> > "Specify include directories or targets to use when compiling a given
> > target."
> >
> > Here is a little test of it. Project directory:
> >
> > Foo
> >   CMakeLists.txt
> >   FooSrc
> >     a.h
> >     a.cpp
> >   Bar
> >     main.cpp
> >
> > And CMakeLists.txt:
> >
> > cmake_minimum_required(VERSION 3.0)
> >
> > project(FooBar)
> >
> > add_library(Foo FooSrc/a.h FooSrc/a.cpp)
> >
> > target_include_directories(Foo PUBLIC G:/some_directory)
> >
> > if (TARGET Foo)
> >     message("Foo is a target!")
> > endif()
> >
> > add_executable(Bar Bar/main.cpp)
> >
> > target_include_directories(Bar PRIVATE Foo)
> >
> > According to the docs, Bar's include directories should contain at
> > least "G:/some_directory", but it contains
> > "${PROJECT_SOURCE_DIR}/Foo". Why?
> >
> > If I replace the last line with target_link_libraries(Bar PRIVATE
> > Foo), then Bar's include directories meet my expectations.
> >
> > regards
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141117/62ff3713/attachment.html>


More information about the cmake-developers mailing list