[cmake-developers] Review Request: Automatically link to libqtmain on Windows

Brad King brad.king at kitware.com
Wed Jan 16 10:12:07 EST 2013


On 01/15/2013 03:51 PM, Brad King wrote:
> +      cmake_policy(GET_WARNING CMP0020 warnMessage)
> +      message(WARNING ${warnMessage})
> 
> should use message(AUTHOR_WARNING).  All policy warnings are for authors.

One problem with this approach is that it will produce warnings for
every project that has not set the policy when they find_package(Qt4).
This will be confusing and requires every project to be modified to
be made aware of the policy (or require 2.8.11) whether it uses the
imported targets or not.

I think we need C++-side help for this.  The policy setting should
be recorded when the target to be linked is created.  That recorded
setting should be used when evaluating the link interface.  Perhaps
we need a generator expression like

 $<TARGET_POLICY:CMP0020>

which evaluates to 1 if the policy is set to NEW when the target was
created and 0 otherwise.  If the policy is not set then the C++ code
evaluating this expression can generate the policy warning.  Only
specific policies that get recorded at target creation are allowed.
Others generate an error.

-Brad



More information about the cmake-developers mailing list