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

David Faure faure at kde.org
Tue Dec 22 22:08:23 UTC 2015


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
 
 if (UNIX AND NOT APPLE)
     # Enable adding DT_RUNPATH, which means that LD_LIBRARY_PATH takes precedence
diff --git a/kde-modules/KDEFrameworkCompilerSettings.cmake b/kde-modules/KDEFrameworkCompilerSettings.cmake
index 55ab36c..8726c2a 100644
--- a/kde-modules/KDEFrameworkCompilerSettings.cmake
+++ b/kde-modules/KDEFrameworkCompilerSettings.cmake
@@ -30,7 +30,7 @@
 # (To distribute this file outside of extra-cmake-modules, substitute the full
 #  License text for the above reference.)
 
-include(KDECompilerSettings)
+include(KDECompilerSettings NO_POLICY_SCOPE)
 
 add_definitions(-DQT_NO_CAST_TO_ASCII
                 -DQT_NO_CAST_FROM_ASCII

karchive:
========
index 0d1f96d..a47dc76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKA
 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
 
 include(KDEInstallDirs)
-include(KDEFrameworkCompilerSettings)
+include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
 include(KDECMakeSettings)
 

cmake output in karchive:
========
CMake Warning (dev) at /d/kde/inst/kde_frameworks/share/ECM/modules/ECMAddTests.cmake:97 (add_executable):
  Policy CMP0063 is not set: Honor visibility properties for all target
  types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "deprecatedtest" of type "EXECUTABLE" has the following visibility
  properties set for CXX:

    CXX_VISIBILITY_PRESET
    VISIBILITY_INLINES_HIDDEN

  For compatibility CMake is not honoring them for this target.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-buildsystem mailing list