[CMake] Why does INTERFACE type targets only support whitelisted properties?

Nils Gladitz nilsgladitz at gmail.com
Fri Jan 8 06:21:27 EST 2016


On 01/08/2016 11:22 AM, Yves Frederix wrote:
> Hi all,
>
> Motivated by my own struggles with targets of type INTERFACE and a
> recent post on this list, I was wondering what is the rationale behind
> allowing only a whitelisted set of properties on targets of this type.
> I understand that one of the use cases for INTERFACE libraries is to
> have a way to work with header-only libraries in a more or less
> standard way. Yes, the current implementation is far from optimal on
> more than one aspect, but I never understood the reason for the
> whitelisting (also google didn't make me any wiser). What am I
> missing? Wouldn't INTERFACE targets be easier to use without these
> restrictions (or alternatively by switching to blacklisting of some
> properties to protect a user from having wrong expectations)?

It might help the discussion if you could elaborate what use cases you 
have in mind for non-whitelisted properties.

Assuming you mean the recent discussion on the FOLDER property:
   The FOLDER property would have no effect on interface targets even if 
the property were whitelisted.
   Interface targets don't have project files so there is nothing to be 
sorted into a folder either.

As for whitelisting vs blacklisting:
   The whitelist is significantly shorter and easier to maintain (when 
new properties are added) than an equivalent blacklist.

Nils




More information about the CMake mailing list