I think if you manipulate the target property INCLUDE_DIRECTORIES
directly, you should be able to force a "." in there without having it
substituted for an absolute path. By this I mean use set_property() or
set_target_properties() rather than target_include_directories() or
include_directories(). Note, however, that the documentation for the
INCLUDE_DIRECTORIES property explicitly recommends against adding relative
paths to the property like this (but in your case it sounds like you really
want a relative path, so maybe this is a valid exception to that advice).
On Mon, Oct 17, 2016 at 9:46 AM, Steve Lorimer <steve.lori...@gmail.com>
> In makefile parlance, I'm trying to add -I. (ie: the current directory) to
> my include paths
> I tried the following:
> This doesn't work unfortunately, as relative paths are interpreted as
> relative to the current source directory
> That is, if this statement is in my top level CMakeLists.txt, located in
> ~/src/project, the include directive added will be "-I ~/src/project/.",
> whereas I'm trying to add "-I ."
> The reason for my wanting this is that we have sources for a single
> library in several subdirs.
> In bar/bar.cpp, I have a relative include
> #include "../foo.h"
> With the above setup, this will fail to compile as only ~/src/project/foo
> will be added to the include paths.
> I'm aware that if I explicitly added the path it would work
> However, if there is a way to get -I. added to my include path, that's
> what I'm after.
> Powered by www.kitware.com
> Please keep messages on-topic and check the CMake FAQ at:
> 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/
> Follow this link to subscribe/unsubscribe:
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
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
Follow this link to subscribe/unsubscribe: