summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2018-10-03 13:36:58 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2018-10-10 14:56:00 (GMT)
commit0d988f98e531333b32d0f1628acf86f8baa22241 (patch)
tree882f2cb255dc0947d3e199169405c568e021db5e /Modules
parentf9f96598df3164cf12b6da7764bc74361e3fa414 (diff)
downloadCMake-0d988f98e531333b32d0f1628acf86f8baa22241.zip
CMake-0d988f98e531333b32d0f1628acf86f8baa22241.tar.gz
CMake-0d988f98e531333b32d0f1628acf86f8baa22241.tar.bz2
cmake_policy: Add undocumented GET_WARNING command
This command is intended for modules that issue policy warnings so they can get the warning string from CMake in a uniform manner, rather than duplicating the string. Several modules been updated to include an example of the usage of this new command.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/BundleUtilities.cmake7
-rw-r--r--Modules/FindOpenGL.cmake6
-rw-r--r--Modules/UseSWIG.cmake7
3 files changed, 6 insertions, 14 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 31db25a..a7e80e7 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -230,11 +230,8 @@ if(DEFINED CMAKE_GENERATOR)
if(_BundleUtilities_CMP0080 STREQUAL "NEW")
message(FATAL_ERROR "BundleUtilities cannot be included at configure time!")
elseif(NOT _BundleUtilities_CMP0080 STREQUAL "OLD")
- message(AUTHOR_WARNING
- "Policy CMP0080 is not set: BundleUtilities prefers not to be included at configure time. "
- "Run \"cmake --help-policy CMP0080\" for policy details. "
- "Use the cmake_policy command to set the policy and suppress this warning."
- )
+ cmake_policy(GET_WARNING CMP0080 _cmp0080_warning)
+ message(AUTHOR_WARNING "${_cmp0080_warning}\n")
endif()
endif()
diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake
index 16c794b..832dca2 100644
--- a/Modules/FindOpenGL.cmake
+++ b/Modules/FindOpenGL.cmake
@@ -268,11 +268,9 @@ else()
endif()
if(_OpenGL_GL_POLICY_WARN AND OPENGL_gl_LIBRARY AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY)
+ cmake_policy(GET_WARNING CMP0072 _cmp0072_warning)
message(AUTHOR_WARNING
- "Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when available. "
- "Run \"cmake --help-policy CMP0072\" for policy details. "
- "Use the cmake_policy command to set the policy and suppress this warning."
- "\n"
+ "${_cmp0072_warning}\n"
"FindOpenGL found both a legacy GL library:\n"
" OPENGL_gl_LIBRARY: ${OPENGL_gl_LIBRARY}\n"
"and GLVND libraries for OpenGL and GLX:\n"
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index f20a53b..edb8294 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -554,11 +554,8 @@ function(SWIG_ADD_LIBRARY name)
set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
else()
if (NOT target_name_policy)
- message(AUTHOR_WARNING
- "Policy CMP0078 is not set. "
- "Run \"cmake --help-policy CMP0078\" for policy details. "
- "Use the cmake_policy command to set the policy and suppress this warning."
- )
+ cmake_policy(GET_WARNING CMP0078 _cmp0078_warning)
+ message(AUTHOR_WARNING "${_cmp0078_warning}\n")
endif()
if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE)
set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY)