[CMake] target_include_directories and relative paths inside generator expressions.

Andrew Fuller mactalla.obair at gmail.com
Wed Apr 23 13:54:12 EDT 2014


Running CMake 3.0-rc3 and the docs for target_include_directories say the
paths may be absolute or relative.  Indeed the following works as desired:

target_include_directories( MyTarget PRIVATE some/dir )

The docs also mention that generator expressions can be used.  However the
following produces an error:

target_include_directories( MyTarget PRIVATE
$<$<PLATFORM_ID:Linux>:some/dir> )

CMake Error in CMakeLists.txt:
Found relative path while evaluating include directories of
  "foo":
    "some/dir"

It seems absolute paths are necessary. eg:

target_include_directories( MyTarget PRIVATE
$<$<PLATFORM_ID:Linux>:${CMAKE_CURRENT_SOURCE_DIR}/some/dir> )

will perform as expected.

Is this behaviour expected (and should be documented) or should I file a
bug?

Thanks,
-Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140423/b12b0e15/attachment.html>


More information about the CMake mailing list