[CMake] target_include_directories and relative paths inside generator expressions.

Andrew Fuller mactalla.obair at gmail.com
Thu Apr 24 19:04:42 EDT 2014


On Thu, Apr 24, 2014 at 1:21 AM, Stephen Kelly <steveire at gmail.com> wrote:

> Andrew Fuller wrote:
>
> > 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?
>
> CMake doesn't know at configure-time what the $<...> at the start of the
> path will evaluate to at generate time (It could even be different things,
> depending on the config).


Oh okay.  I didn't realize that expanding relative paths to absolute would
be done prior to evaluating the generator expression.  Now that I know that
detail the current behaviour is understandable.

Thanks for the clarification.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140424/8d9d6c27/attachment.html>


More information about the CMake mailing list