[cmake-developers] Interface includes and defines plumbing

Brad King brad.king at kitware.com
Mon Jan 7 16:29:36 EST 2013


On 01/07/2013 03:36 PM, Stephen Kelly wrote:
> Perhaps it should be 
> 
>  install(TARGETS testLibRequired
>          EXPORT RequiredExp DESTINATION lib
>          INTERFACE_INCLUDES
>            "/foo/bar"
>  )
> 
> ?

That looks better, but I think it is best to wait until we gain more
experience with the new capabilities.  We can always add convenience
interfaces later but we can't take them away.

>> wonder if we should hold off on this convenience interface until more
>> of the new usage interface magic is worked out.  We may be able to
>> find an even more convenient way to set a whole bunch of stuff on
>> an installed target's interface.
> 
> Ok. I can split CMAKE_BUILD_INTERFACE_INCLUDES into a topic of its own.

Yes.

> Yes, I can modify it to that effect. I was also thinking that for the 
> includes command it might make sense to have a BEFORE keyword, but I'm not 
> certain.

I'm sure it won't take long for someone to ask for it if it isn't there.
It essentially asks for the arguments to be prefixed instead of appended
on the property value.

> I also have a slight concern that 
> 
>  target_compile_definitions(foo PRIVATE bar)
> 
> has an ambiguous meaning. 

Yes, this is in part a consequence of CMake's syntax and conventions.

> It could mean 'take the INTERFACE_COMPILE_DEFINITIONS from the bar target 
> and use them' or it could mean 'Add -Dbar to the COMPILE_DEFINITIONS', 
> depending on whether a target called 'bar' exists. 
> 
> The workaround is to use set_property in that case. 
> 
> target_include_directories does not have that problem, as paths must be 
> absolute.
> 
> What do you think?

Allow "bar=" to mean a definition with no value.  It will never be
confused with a target name.  Fortunately target names are usually
lower case and macros are usually upper case so this conflict will
be rare in practice.

-Brad



More information about the cmake-developers mailing list