[cmake-developers] Generator expressisons in target properties

Brad King brad.king at kitware.com
Tue Nov 13 09:24:21 EST 2012


On 11/11/2012 01:32 PM, Stephen Kelly wrote:
> This means that if the user starts to use non-trivial content in the 
> INTERFACE_LINK_LIBRARIES content, then old behavior will be chosen (unless 
> the policy is set).

Right, so applications will not change their behavior until they
have been updated to be aware of it.  This is a feature of policies.

> That might be fine, in that the explicit act needed by the person 
> implementing the buildsystem for foo to change that is:
> 
>  set_minimum_required(VERSION 2.8.11)

The proposed policy is set in the consumer, not the producer.
They will get a warning that describes the behavior change if
the old and new interfaces produce different results.

They can choose the new behavior when available with

 if(POLICY CMPxxxx)
   cmake_policy(SET CMPxxxx NEW) # remove when min req is 2.8.11
 endif()

without otherwise requiring 2.8.11.

>> However, how do we
>> eventually stop adding the old interfaces to the export files?
> 
> It might depend on what the contents of the properties are.
[snip]
> In case non-trivial generator expressions are used, maybe we would need to 
> add:
> 
>  if (CMAKE_VERSION VERSION_LESS 2.8.11)
>     message(FATAL_ERROR "This file requires CMake 2.8.11 or later")
>  endif()
> 
> when exporting the targets.

Something like that may work.

Thanks,
-Brad



More information about the cmake-developers mailing list