setting policies centrally (was: cmCMakePolicyCommand: New PARENT_SCOPE argument)

Alex Merry alex.merry at kde.org
Sun Dec 27 11:22:22 UTC 2015


On 2015-12-22 22:08, David Faure wrote:
> On Monday 17 August 2015 09:25:01 Brad King wrote:
>> 
>> So, I think we are back to asking projects to explicitly allow
>> an included module to set policies by using NO_POLICY_SCOPE.
> 
> As much as I hate that solution, I was about to go ahead and do it, to
> finally fix the warning.
> 
> But I must be doing it wrong, it doesn't work?
> 
> ECM:
> ========
> diff --git a/kde-modules/KDECompilerSettings.cmake
> b/kde-modules/KDECompilerSettings.cmake
> index 707e5d7..68e007e 100644
> --- a/kde-modules/KDECompilerSettings.cmake
> +++ b/kde-modules/KDECompilerSettings.cmake
> @@ -199,6 +199,7 @@ endif()
>  set(CMAKE_C_VISIBILITY_PRESET hidden)
>  set(CMAKE_CXX_VISIBILITY_PRESET hidden)
>  set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
> +set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) # don't let cmake >= 3.3 warn
> about the above

You need to actually set the policy, (it's too late at this point to 
just set the policy default).

if (POLICY CMP0063)
     # No sane project should be affected by CMP0063, so suppress the
     # warnings generated by the above visibility settings in CMake >= 
3.3
     cmake_policy(SET CMP0063 NEW)
endif()

The documentation for KDECompilerSettings and 
KDEFrameworksCompilerSettings needs to mention how they should be 
included with NO_POLICY_SCOPE.

I think we should do the same (recommend/use NO_POLICY_SCOPE) with 
KDECMakeSettings, because that's the other module that's likely to run 
into issues like this.

Alex



More information about the Kde-buildsystem mailing list