[cmake-developers] Exports, genexes and INTERFACE_INCLUDE_DIRECTORIES

Brad King brad.king at kitware.com
Mon Nov 25 11:08:20 EST 2013


On 11/25/2013 10:11 AM, Stephen Kelly wrote:
> I've just pushed the export-includes topic to my clone. It adds some 
> testcases and new errors for cases involving INTERFACE_INCLUDE_DIRECTORIES 
> with generator expressions which are not at the start of the path. It turns 
> out we have some bugs there, some of which need policies to solve, I think.
> 
> Before implementing the policies, could I get a review of what I wrote and 
> tested to be 'good code' and 'bad code'? It's a bit complex.

I'll quote the part of the commit message describing behavior changes:

> The
> 
>  install(... INCLUDES DESTINATION)
> 
> calls exavluate the generator expressions at export-time, so it is
> fully determined whether they contain absolute or relative paths.
> In this case, relative paths are always treated relative to the
> $<INSTALL_PREFIX>.
> 
> Relative entries within $<INSTALL_INTERFACE:...>, when used in contexts
> other than 'INCLUDES DESTINATION', are treated relative to
> the $<INSTALL_PREFIX>, unless they start with a generator expression.
> 
> Relative paths set through set_property are treated as relative (with
> an error diagnosis), even if they contain a generator expression. However,
> using a generator expression at the start of the entry is not an error
> in this case.
> 
> Relative paths set through target_include_directories are treated as
> relative to the source directory, if they are not wrapped
> in $<INSTALL_INTERFACE>, if they contain a generator expression which
> is not at the start. This requires an error diagnosis.

That all sounds like a reasonable behavior.  Please ensure that the
docs and test cases cover all of it.  As you say we'll need policies
for the new error cases.

Thanks,
-Brad



More information about the cmake-developers mailing list