[CMake] target_include_directories and relative paths inside generator expressions.

Stephen Kelly steveire at gmail.com
Thu Apr 24 04:21:54 EDT 2014


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). 

I thought that would be obvious, but a patch to 

 Help/manual/cmake-buildsystem.7.rst

or

 Help/command/target_include_directories.rst

might help.

Thanks,

Steve.




More information about the CMake mailing list