From 763cfbcac87b4e7f03e0bf60af9ff4d67e513d30 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Wed, 20 May 2026 15:32:57 -0400 Subject: [PATCH] Diagnostics: "Fix" policy warnings in modules Introduce a mechanism (via the private and undocumented `ISSUE_WARNING` option to the `cmake_policy` command) to allow built-in modules to issue policy warnings. Update modules to use this. This allows modules to issue policy warnings with the `CMD_POLICY` diagnostic type, which is consistent with internally issued diagnostics. This also tends to simplify the logic for issuing such warnings in much the way the helpers introduced in the previous commit did for the C++ code. --- Modules/BundleUtilities.cmake | 7 +-- Modules/CMakeDependentOption.cmake | 3 +- Modules/CMakeDetermineASMCompiler.cmake | 3 +- Modules/CPack.cmake | 24 ++++----- Modules/CheckIncludeFile.cmake | 6 +-- Modules/CheckIncludeFileCXX.cmake | 6 +-- Modules/CheckIncludeFiles.cmake | 6 +-- Modules/Compiler/ARMClang.cmake | 4 +- Modules/Dart.cmake | 3 +- Modules/Documentation.cmake | 4 +- Modules/ExternalProject.cmake | 10 ++-- .../shared_internal_commands.cmake | 4 +- Modules/FeatureSummary.cmake | 3 +- Modules/FindOpenGL.cmake | 4 +- Modules/GoogleTest.cmake | 18 +++---- Modules/UseSWIG.cmake | 9 ++-- Source/cmCMakePolicyCommand.cxx | 51 +++++++++++++++++++ .../BundleUtilities/CMP0080-WARN-stderr.txt | 7 ++- .../RunCMake/CMP0106/CMP0106-WARN-stderr.txt | 10 ++-- .../RunCMake/CMP0150/CMP0150-WARN-stderr.txt | 4 +- .../RunCMake/CMP0194/CMP0194-WARN-stderr.txt | 7 +-- .../Parentheses-CMP0127-WARN-stderr.txt | 7 +-- .../CPackConfig/CMP0133-WARN-stderr.txt | 7 +-- .../CMP0161-WARN-stderr-darwin.txt | 7 +-- .../CPackConfig/CMP0172-WARN-stderr.txt | 7 +-- .../CPackConfig/CMP0206-WARN-stderr.txt | 7 +-- .../CTest/CMP0145-Dart-WARN-stderr.txt | 7 +-- .../RunCMake/CheckModules/CMP0075-stderr.txt | 21 ++++---- .../NO_DEPENDS-CMP0114-WARN-stderr.txt | 21 ++++---- ...SummaryParentheses-CMP0183-WARN-stderr.txt | 7 +-- .../FindOpenGL/CMP0072-WARN-stderr.txt | 5 +- .../Launcher-CMP0178-WARN-stderr.txt | 14 ++--- .../RunCMake/UseSWIG/CMP0078-WARN-stderr.txt | 6 +-- .../RunCMake/UseSWIG/CMP0086-WARN-stderr.txt | 6 +-- .../RunCMake/UseSWIG/CMP0122-WARN-stderr.txt | 6 +-- 35 files changed, 171 insertions(+), 150 deletions(-) diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 782e8ad55b..7b063f8a6d 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -506,18 +506,13 @@ installation phase: ") #]=======================================================================] -function(_warn_cmp0080) - cmake_policy(GET_WARNING CMP0080 _cmp0080_warning) - message(AUTHOR_WARNING "${_cmp0080_warning}\n") -endfunction() - # Do not include this module at configure time! if(DEFINED CMAKE_GENERATOR) cmake_policy(GET CMP0080 _BundleUtilities_CMP0080) if(_BundleUtilities_CMP0080 STREQUAL "NEW") message(FATAL_ERROR "BundleUtilities cannot be included at configure time!") elseif(NOT _BundleUtilities_CMP0080 STREQUAL "OLD" AND NOT _CMP0080_SUPPRESS_WARNING) - _warn_cmp0080() + cmake_policy(ISSUE_WARNING CMP0080) endif() endif() diff --git a/Modules/CMakeDependentOption.cmake b/Modules/CMakeDependentOption.cmake index 0d840fcfe0..a000f4cd81 100644 --- a/Modules/CMakeDependentOption.cmake +++ b/Modules/CMakeDependentOption.cmake @@ -246,8 +246,7 @@ macro(CMAKE_DEPENDENT_OPTION option doc default depends force) set(${option} "${${option}_ISSET}") endif() if("x${_CDO_CMP0127}x" STREQUAL "xx" AND "x${depends}x" MATCHES "[^A-Za-z0-9_.; ]") - cmake_policy(GET_WARNING CMP0127 _CDO_CMP0127_WARNING) - message(AUTHOR_WARNING "${_CDO_CMP0127_WARNING}") + cmake_policy(ISSUE_WARNING CMP0127) endif() unset(_CDO_CMP0127) endmacro() diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index fbfa52c27a..1ca5e731c4 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -234,8 +234,7 @@ else() endif() if("ASM${ASM_DIALECT}" STREQUAL "ASM" AND CMAKE_ASM_COMPILER_ID STREQUAL "MSVC" AND _CMAKE_ASM_CMP0194 STREQUAL "") - cmake_policy(GET_WARNING CMP0194 _CMAKE_ASM_CMP0194_WARNING) - message(AUTHOR_WARNING "${_CMAKE_ASM_CMP0194_WARNING}") + cmake_policy(ISSUE_WARNING CMP0194) endif() # If we have a gas/as cross compiler, they have usually some prefix, like diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index b8e704941a..4104f87de4 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -899,10 +899,9 @@ if(NOT DEFINED CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE cmake_policy(GET CMP0133 _CPack_CMP0133) if(NOT "x${_CPack_CMP0133}x" STREQUAL "xNEWx") if(NOT "x${_CPack_CMP0133}x" STREQUAL "xOLDx" AND CMAKE_POLICY_WARNING_CMP0133) - cmake_policy(GET_WARNING CMP0133 _CMP0133_warning) - message(AUTHOR_WARNING - "${_CMP0133_warning}\n" - "For compatibility, CMake will enable the SLA in the CPack DragNDrop Generator." + cmake_policy(ISSUE_WARNING CMP0133 POST + "For compatibility, CMake will enable the SLA " + "in the CPack DragNDrop Generator." ) unset(_CMP0133_warning) endif() @@ -925,10 +924,9 @@ if(NOT DEFINED CPACK_WIX_INSTALL_SCOPE) if("x${_CPack_CMP0172}x" STREQUAL "xNEWx") _cpack_set_default(CPACK_WIX_INSTALL_SCOPE perMachine) elseif(NOT "x${_CPack_CMP0172}x" STREQUAL "xOLDx" AND CMAKE_POLICY_WARNING_CMP0172) - cmake_policy(GET_WARNING CMP0172 _CMP0172_warning) - message(AUTHOR_WARNING - "${_CMP0172_warning}\n" - "For compatibility, CMake will not enable per-machine installation by default in the CPack WIX Generator." + cmake_policy(ISSUE_WARNING CMP0172 POST + "For compatibility, CMake will not enable per-machine installation " + "by default in the CPack WIX Generator." ) unset(_CMP0172_warning) endif() @@ -942,13 +940,11 @@ if("x${_CPack_CMP0161}x" STREQUAL "xNEWx") elseif(APPLE AND CPACK_BINARY_PRODUCTBUILD AND NOT DEFINED CPACK_PRODUCTBUILD_DOMAINS AND NOT "x${_CPack_CMP0161}x" STREQUAL "xOLDx") - cmake_policy(GET_WARNING CMP0161 _CMP0161_warning) - message(AUTHOR_WARNING - "${_CMP0161_warning}\n" + cmake_policy(ISSUE_WARNING CMP0161 POST "For compatibility, CPACK_PRODUCTBUILD_DOMAINS will remain unset. " "Explicitly setting CPACK_PRODUCTBUILD_DOMAINS or setting policy CMP0161 " "to NEW will prevent this warning." - ) + ) unset(_CMP0161_warning) endif() unset(_CPack_CMP0161) @@ -958,9 +954,7 @@ if(NOT DEFINED CPACK_ARCHIVE_UID AND NOT DEFINED CPACK_ARCHIVE_GID) cmake_policy(GET CMP0206 _CPack_CMP0206) if(NOT "x${_CPack_CMP0206}x" STREQUAL "xNEWx") if(NOT "x${_CPack_CMP0206}x" STREQUAL "xOLDx" AND CMAKE_POLICY_WARNING_CMP0206) - cmake_policy(GET_WARNING CMP0206 _CMP0206_warning) - message(AUTHOR_WARNING - "${_CMP0206_warning}\n" + cmake_policy(ISSUE_WARNING CMP0206 POST "For compatibility, CMake will set archive UID/GID to -1/-1." ) unset(_CMP0206_warning) diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index 74f0edb0e0..8acd6cf26b 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -151,11 +151,7 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) elseif("x${_CIF_CMP0075}x" STREQUAL "xOLDx") elseif(NOT _CIF_CMP0075_WARNED) set(_CIF_CMP0075_WARNED 1) - message(AUTHOR_WARNING - "Policy CMP0075 is not set: Include file check macros honor CMAKE_REQUIRED_LIBRARIES. " - "Run \"cmake --help-policy CMP0075\" for policy details. " - "Use the cmake_policy command to set the policy and suppress this warning." - "\n" + cmake_policy(ISSUE_WARNING CMP0075 POST "CMAKE_REQUIRED_LIBRARIES is set to:\n" " ${CMAKE_REQUIRED_LIBRARIES}\n" "For compatibility with CMake 3.11 and below this check is ignoring it." diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index 3d487a4f41..9dade6be78 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -120,11 +120,7 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) elseif("x${_CIF_CMP0075}x" STREQUAL "xOLDx") elseif(NOT _CIF_CMP0075_WARNED) set(_CIF_CMP0075_WARNED 1) - message(AUTHOR_WARNING - "Policy CMP0075 is not set: Include file check macros honor CMAKE_REQUIRED_LIBRARIES. " - "Run \"cmake --help-policy CMP0075\" for policy details. " - "Use the cmake_policy command to set the policy and suppress this warning." - "\n" + cmake_policy(ISSUE_WARNING CMP0075 POST "CMAKE_REQUIRED_LIBRARIES is set to:\n" " ${CMAKE_REQUIRED_LIBRARIES}\n" "For compatibility with CMake 3.11 and below this check is ignoring it." diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 98703402e9..00fce8c47b 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -175,11 +175,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) elseif("x${_CIF_CMP0075}x" STREQUAL "xOLDx") elseif(NOT _CIF_CMP0075_WARNED) set(_CIF_CMP0075_WARNED 1) - message(AUTHOR_WARNING - "Policy CMP0075 is not set: Include file check macros honor CMAKE_REQUIRED_LIBRARIES. " - "Run \"cmake --help-policy CMP0075\" for policy details. " - "Use the cmake_policy command to set the policy and suppress this warning." - "\n" + cmake_policy(ISSUE_WARNING CMP0075 POST "CMAKE_REQUIRED_LIBRARIES is set to:\n" " ${CMAKE_REQUIRED_LIBRARIES}\n" "For compatibility with CMake 3.11 and below this check is ignoring it." diff --git a/Modules/Compiler/ARMClang.cmake b/Modules/Compiler/ARMClang.cmake index ae78b3bec8..a3c7086ed9 100644 --- a/Modules/Compiler/ARMClang.cmake +++ b/Modules/Compiler/ARMClang.cmake @@ -99,9 +99,7 @@ macro(__compiler_armclang lang) cmake_policy(GET CMP0123 policy_CMP0123) if(NOT "x${CMAKE_ARMClang_CMP0123}x" STREQUAL "xNEWx") if(NOT "x${CMAKE_ARMClang_CMP0123}x" STREQUAL "xOLDx") - cmake_policy(GET_WARNING CMP0123 _cmp0123_warning) - message(AUTHOR_WARNING - "${_cmp0123_warning}\n" + cmake_policy(ISSUE_WARNING CMP0123 POST "For compatibility, CMake will automatically add cpu/arch flags based " "on the CMAKE_SYSTEM_PROCESSOR and/or CMAKE_SYSTEM_ARCH variables." ) diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake index e7967a00ff..93a9381033 100644 --- a/Modules/Dart.cmake +++ b/Modules/Dart.cmake @@ -43,8 +43,7 @@ whether testing support should be enabled. The default is ON. # which will not warn. Warn again just in case. cmake_policy(GET CMP0145 cmp0145) if(cmp0145 STREQUAL "") - cmake_policy(GET_WARNING CMP0145 _cmp0145_warning) - message(AUTHOR_WARNING "${_cmp0145_warning}") + cmake_policy(ISSUE_WARNING CMP0145) endif() option(BUILD_TESTING "Build the testing tree." ON) diff --git a/Modules/Documentation.cmake b/Modules/Documentation.cmake index bd300682cb..fdde7d71c7 100644 --- a/Modules/Documentation.cmake +++ b/Modules/Documentation.cmake @@ -26,9 +26,7 @@ if (_Documentation_policy STREQUAL "") # Ignore the warning if the project is detected as VTK itself. if (NOT CMAKE_PROJECT_NAME STREQUAL "VTK" AND NOT PROJECT_NAME STREQUAL "VTK") - cmake_policy(GET_WARNING CMP0106 _Documentation_policy_warning) - message(AUTHOR_WARNING - "${_Documentation_policy_warning}\n" + cmake_policy(ISSUE_WARNING CMP0106 POST "Documentation.cmake is VTK-specific code and should not be used in " "non-VTK projects. This logic in this module is best shipped with the " "project using it rather than with CMake.") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 1045259611..bd24ce3a98 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -2153,8 +2153,7 @@ function(ExternalProject_Add_StepTargets name) ) endif() elseif(cmp0114 STREQUAL "") - cmake_policy(GET_WARNING CMP0114 _cmp0114_warning) - string(APPEND _cmp0114_warning "\n" + string(JOIN "" _cmp0114_warning "ExternalProject target '${name}' would depend on the targets for " "step(s) '${steps}' under policy CMP0114, but this is being left out " "for compatibility since the policy is not set." @@ -2164,7 +2163,7 @@ function(ExternalProject_Add_StepTargets name) "Also, the NO_DEPENDS option is deprecated in favor of policy CMP0114." ) endif() - message(AUTHOR_WARNING "${_cmp0114_warning}") + cmake_policy(ISSUE_WARNING CMP0114 POST "${_cmp0114_warning}") endif() foreach(step IN LISTS steps) _ep_step_add_target("${name}" "${step}" "${no_deps}") @@ -2507,14 +2506,11 @@ function(ExternalProject_Add_Step name step) set_property(TARGET ${name} PROPERTY _EP_CMP0114_WARNED_INDEPENDENT_STEP_TARGETS 1 ) - cmake_policy(GET_WARNING CMP0114 _cmp0114_warning) - string(APPEND _cmp0114_warning - "\n" + cmake_policy(ISSUE_WARNING CMP0114 POST "ExternalProject '${name}' option INDEPENDENT_STEP_TARGETS is set to" "\n ${independent_step_targets}\n" "but the option is deprecated in favor of policy CMP0114." ) - message(AUTHOR_WARNING "${_cmp0114_warning}") endif() endif() foreach(st IN LISTS independent_step_targets) diff --git a/Modules/ExternalProject/shared_internal_commands.cmake b/Modules/ExternalProject/shared_internal_commands.cmake index 71d95c4716..1ee015378c 100644 --- a/Modules/ExternalProject/shared_internal_commands.cmake +++ b/Modules/ExternalProject/shared_internal_commands.cmake @@ -175,9 +175,7 @@ function(_ep_resolve_git_remote set("${output_variable}" "${_resolved_git_remote_url}" PARENT_SCOPE) return() elseif(cmp0150 STREQUAL "") - cmake_policy(GET_WARNING CMP0150 _cmp0150_warning) - message(AUTHOR_WARNING - "${_cmp0150_warning}\n" + cmake_policy(ISSUE_WARNING CMP0150 POST "A relative GIT_REPOSITORY path was detected. " "This will be interpreted as a local path to where the project is being cloned. " "Set GIT_REPOSITORY to an absolute path or set policy CMP0150 to NEW to avoid " diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 6b83903d14..9c412242ce 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -966,8 +966,7 @@ function(ADD_FEATURE_INFO _name _depends _desc) set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" ) if("x${_CDO_CMP0183}x" STREQUAL "xx" AND "x${_depends}x" MATCHES "[^A-Za-z0-9_.; ]") - cmake_policy(GET_WARNING CMP0183 _CDO_CMP0183_WARNING) - message(AUTHOR_WARNING "${_CDO_CMP0183_WARNING}") + cmake_policy(ISSUE_WARNING CMP0183) endif() unset(_CDO_CMP0183) endfunction() diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 6362edf2e4..3886db9671 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -536,9 +536,7 @@ 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 - "${_cmp0072_warning}\n" + cmake_policy(ISSUE_WARNING CMP0072 POST "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/GoogleTest.cmake b/Modules/GoogleTest.cmake index 6db0d67f14..b73e4d63d1 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -381,12 +381,10 @@ function(gtest_add_tests) # the latter. set(__newArgs ${arg_new_EXTRA_ARGS}) if(NOT "${arg_EXTRA_ARGS}" STREQUAL "${__newArgs}") - cmake_policy(GET_WARNING CMP0178 cmp0178_warning) - message(AUTHOR_WARNING + cmake_policy(ISSUE_WARNING CMP0178 PRE "The EXTRA_ARGS contain one or more empty values. Those empty " "values are being silently discarded to preserve backward " - "compatibility.\n" - "${cmp0178_warning}" + "compatibility." ) endif() endblock() @@ -634,24 +632,20 @@ function(gtest_discover_tests target) set(test_executor ${test_executor}) if(NOT cmp0178 STREQUAL "OLD") if(NOT "${test_executor}" STREQUAL "${test_executor_orig}") - cmake_policy(GET_WARNING CMP0178 cmp0178_warning) - message(AUTHOR_WARNING + cmake_policy(ISSUE_WARNING CMP0178 PRE "The '${target}' target's TEST_LAUNCHER or CROSSCOMPILING_EMULATOR " "test properties contain one or more empty values. Those empty " "values are being silently discarded to preserve backward " - "compatibility.\n" - "${cmp0178_warning}" + "compatibility." ) endif() # Unescape semicolons from the PARSE_ARGV form's value before comparing string(REPLACE [[\;]] ";" new_arg_EXTRA_ARGS "${new_arg_EXTRA_ARGS}") if(NOT "${old_arg_EXTRA_ARGS}" STREQUAL "${new_arg_EXTRA_ARGS}") - cmake_policy(GET_WARNING CMP0178 cmp0178_warning) - message(AUTHOR_WARNING + cmake_policy(ISSUE_WARNING CMP0178 PRE "The EXTRA_ARGS value contains one or more empty values. " "Those empty values are being silently discarded to preserve " - "backward compatibility.\n" - "${cmp0178_warning}" + "backward compatibility." ) endif() endif() diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index a469c4fa80..3d901dd81d 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -668,8 +668,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) endif() else() if (NOT module_name_policy) - cmake_policy(GET_WARNING CMP0086 _cmp0086_warning) - message(AUTHOR_WARNING "${_cmp0086_warning}\n") + cmake_policy(ISSUE_WARNING CMP0086) endif() endif() @@ -839,8 +838,7 @@ function(SWIG_ADD_LIBRARY name) set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD) else() if (NOT target_name_policy) - cmake_policy(GET_WARNING CMP0078 _cmp0078_warning) - message(AUTHOR_WARNING "${_cmp0078_warning}\n") + cmake_policy(ISSUE_WARNING CMP0078) endif() if (NOT DEFINED UseSWIG_TARGET_NAME_PREFERENCE) set (UseSWIG_TARGET_NAME_PREFERENCE LEGACY) @@ -1057,8 +1055,7 @@ function(SWIG_ADD_LIBRARY name) # Do *not* override the target's library prefix else() if (NOT csharp_naming_policy) - cmake_policy(GET_WARNING CMP0122 _cmp0122_warning) - message(AUTHOR_WARNING "${_cmp0122_warning}\n") + cmake_policy(ISSUE_WARNING CMP0122) endif() set_target_properties (${target_name} PROPERTIES PREFIX "") endif() diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 9b346d99e0..6fe421ed80 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -2,9 +2,14 @@ file LICENSE.rst or https://cmake.org/licensing for details. */ #include "cmCMakePolicyCommand.h" +#include + +#include "cmArgumentParser.h" +#include "cmArgumentParserTypes.h" #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmPolicies.h" +#include "cmRange.h" #include "cmStringAlgorithms.h" namespace { @@ -16,6 +21,8 @@ bool HandleVersionMode(std::vector const& args, cmExecutionStatus& status); bool HandleGetWarningMode(std::vector const& args, cmExecutionStatus& status); +bool HandleIssueWarningMode(std::vector const& args, + cmExecutionStatus& status); } // cmCMakePolicyCommand @@ -55,6 +62,9 @@ bool cmCMakePolicyCommand(std::vector const& args, if (args[0] == "GET_WARNING") { return HandleGetWarningMode(args, status); } + if (args[0] == "ISSUE_WARNING") { + return HandleIssueWarningMode(args, status); + } status.SetError(cmStrCat("given unknown first argument \"", args[0], '"')); return false; @@ -191,4 +201,45 @@ bool HandleGetWarningMode(std::vector const& args, return true; } + +bool HandleIssueWarningMode(std::vector const& args, + cmExecutionStatus& status) +{ + if (args.size() < 2) { + status.SetError( + "ISSUE_WARNING must be given at least one additional argument."); + return false; + } + + // Get arguments. + std::string const& id = args[1]; + + struct Arguments + { + ArgumentParser::MaybeEmpty> PreArgs; + ArgumentParser::MaybeEmpty> PostArgs; + }; + + static auto const parser = cmArgumentParser{} + .Bind("PRE"_s, &Arguments::PreArgs) + .Bind("POST"_s, &Arguments::PostArgs); + + Arguments const arguments = parser.Parse(cmMakeRange(args).advance(2), + /*unparsedArguments=*/nullptr); + + // Lookup the policy number. + cmPolicies::PolicyID pid; + if (!cmPolicies::GetPolicyID(id.c_str(), pid)) { + status.SetError( + cmStrCat("ISSUE_WARNING given policy \"", id, + "\" which is not known to this version of CMake.")); + return false; + } + + // Issue the policy warning. + status.GetMakefile().IssuePolicyWarning(pid, cmJoin(arguments.PreArgs, {}), + cmJoin(arguments.PostArgs, {})); + + return true; +} } diff --git a/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt b/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt index da0919fccd..dd4e74cd16 100644 --- a/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt +++ b/Tests/RunCMake/BundleUtilities/CMP0080-WARN-stderr.txt @@ -1,10 +1,9 @@ -CMake Warning \(author\) at .*/Modules/BundleUtilities\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at .*/Modules/BundleUtilities\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0080 is not set: BundleUtilities cannot 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\. - Call Stack \(most recent call first\): - .*/Modules/BundleUtilities\.cmake:[0-9]+ \(_warn_cmp0080\) CMP0080-WARN\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. diff --git a/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt b/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt index 497fa58a82..e8dd53d0c1 100644 --- a/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0106/CMP0106-WARN-stderr.txt @@ -8,7 +8,7 @@ Call Stack \(most recent call first\): This warning is for project developers\. Use -Wno-author or -Wno-policy to suppress it\. -CMake Warning \(author\) at .*/Modules/Documentation\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at .*/Modules/Documentation\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0106 is not set: The Documentation module is removed\. Run "cmake --help-policy CMP0106" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. @@ -20,9 +20,10 @@ Call Stack \(most recent call first\): CMP0106-Common\.cmake:1 \(include\) CMP0106-WARN\.cmake:2 \(include\) CMakeLists\.txt:7 \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. -CMake Warning \(author\) at .*/Modules/Documentation\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at .*/Modules/Documentation\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0106 is not set: The Documentation module is removed\. Run "cmake --help-policy CMP0106" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. @@ -34,4 +35,5 @@ Call Stack \(most recent call first\): CMP0106-Common\.cmake:10 \(include\) CMP0106-WARN\.cmake:2 \(include\) CMakeLists\.txt:7 \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. diff --git a/Tests/RunCMake/CMP0150/CMP0150-WARN-stderr.txt b/Tests/RunCMake/CMP0150/CMP0150-WARN-stderr.txt index 37840359d6..c18d628140 100644 --- a/Tests/RunCMake/CMP0150/CMP0150-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0150/CMP0150-WARN-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning \(author\) at .*/Modules/ExternalProject/shared_internal_commands\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at .*/Modules/ExternalProject/shared_internal_commands\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0150 is not set: ExternalProject_Add and FetchContent_Declare commands treat relative GIT_REPOSITORY paths as being relative to the parent project's remote\. Run "cmake --help-policy CMP0150" for policy @@ -11,7 +11,7 @@ CMake Warning \(author\) at .*/Modules/ExternalProject/shared_internal_commands\ Call Stack \(most recent call first\): .*/Modules/ExternalProject\.cmake:[0-9]+ \(_ep_resolve_git_remote\) .* -CMake Warning \(author\) at .*/Modules/ExternalProject/shared_internal_commands\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at .*/Modules/ExternalProject/shared_internal_commands\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0150 is not set: ExternalProject_Add and FetchContent_Declare commands treat relative GIT_REPOSITORY paths as being relative to the parent project's remote\. Run "cmake --help-policy CMP0150" for policy diff --git a/Tests/RunCMake/CMP0194/CMP0194-WARN-stderr.txt b/Tests/RunCMake/CMP0194/CMP0194-WARN-stderr.txt index a989e8b847..9ccbf7227a 100644 --- a/Tests/RunCMake/CMP0194/CMP0194-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0194/CMP0194-WARN-stderr.txt @@ -1,5 +1,5 @@ -^CMake Warning \(author\) at [^ -]*/Modules/CMakeDetermineASMCompiler\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at [^ +]*/Modules/CMakeDetermineASMCompiler\.cmake:[0-9]+ \(cmake_policy\): Policy CMP194 is not set: MSVC is not an assembler for language ASM\. Run "cmake --help-policy CMP194" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. @@ -7,4 +7,5 @@ Call Stack \(most recent call first\): CMP0194-common\.cmake:[0-9]+ \(enable_language\) CMP0194-WARN\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/CMakeDependentOption/Parentheses-CMP0127-WARN-stderr.txt b/Tests/RunCMake/CMakeDependentOption/Parentheses-CMP0127-WARN-stderr.txt index 6dee9c5717..ec2a3e8c6c 100644 --- a/Tests/RunCMake/CMakeDependentOption/Parentheses-CMP0127-WARN-stderr.txt +++ b/Tests/RunCMake/CMakeDependentOption/Parentheses-CMP0127-WARN-stderr.txt @@ -1,9 +1,10 @@ -^CMake Warning \(author\) at [^ -]*/Modules/CMakeDependentOption\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at [^ +]*/Modules/CMakeDependentOption\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0127 is not set: cmake_dependent_option\(\) supports full Condition Syntax\. Run "cmake --help-policy CMP0127" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. Call Stack \(most recent call first\): [^ ]*/Tests/RunCMake/CMakeDependentOption/Parentheses-CMP0127-WARN\.cmake:[0-9]+ \(cmake_dependent_option\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/CPackConfig/CMP0133-WARN-stderr.txt b/Tests/RunCMake/CPackConfig/CMP0133-WARN-stderr.txt index ffcd040a5d..e759821cb5 100644 --- a/Tests/RunCMake/CPackConfig/CMP0133-WARN-stderr.txt +++ b/Tests/RunCMake/CPackConfig/CMP0133-WARN-stderr.txt @@ -1,5 +1,5 @@ -^CMake Warning \(author\) at [^ -]*/Modules/CPack\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at [^ +]*/Modules/CPack\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0133 is not set: The CPack module disables SLA by default in the CPack DragNDrop Generator\. Run "cmake --help-policy CMP0133" for policy details\. Use the cmake_policy command to set the policy and suppress this @@ -9,4 +9,5 @@ Generator\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/CPackConfig/CMP0161-WARN-stderr-darwin.txt b/Tests/RunCMake/CPackConfig/CMP0161-WARN-stderr-darwin.txt index 8e7eb9e4ca..321330d8e3 100644 --- a/Tests/RunCMake/CPackConfig/CMP0161-WARN-stderr-darwin.txt +++ b/Tests/RunCMake/CPackConfig/CMP0161-WARN-stderr-darwin.txt @@ -1,5 +1,5 @@ -^CMake Warning \(author\) at [^ -]*/Modules/CPack\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at [^ +]*/Modules/CPack\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0161 is not set: CPACK_PRODUCTBUILD_DOMAINS defaults to true\. Run "cmake --help-policy CMP0161" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. @@ -9,4 +9,5 @@ NEW will prevent this warning\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/CPackConfig/CMP0172-WARN-stderr.txt b/Tests/RunCMake/CPackConfig/CMP0172-WARN-stderr.txt index ac618a9f7b..63ab3f5623 100644 --- a/Tests/RunCMake/CPackConfig/CMP0172-WARN-stderr.txt +++ b/Tests/RunCMake/CPackConfig/CMP0172-WARN-stderr.txt @@ -1,5 +1,5 @@ -^CMake Warning \(author\) at [^ -]*/Modules/CPack\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at [^ +]*/Modules/CPack\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0172 is not set: The CPack module enables per-machine installation by default in the CPack WIX Generator\. Run "cmake --help-policy CMP0172" for policy details\. Use the cmake_policy command to @@ -9,4 +9,5 @@ default in the CPack WIX Generator\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/CPackConfig/CMP0206-WARN-stderr.txt b/Tests/RunCMake/CPackConfig/CMP0206-WARN-stderr.txt index d94e009b3b..a6930a1c38 100644 --- a/Tests/RunCMake/CPackConfig/CMP0206-WARN-stderr.txt +++ b/Tests/RunCMake/CPackConfig/CMP0206-WARN-stderr.txt @@ -1,5 +1,5 @@ -^CMake Warning \(author\) at [^ -]*/Modules/CPack\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at [^ +]*/Modules/CPack\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0206 is not set: The CPack Archive Generator defaults to UID 0 and GID 0\. Run "cmake --help-policy CMP0206" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. @@ -7,4 +7,5 @@ For compatibility, CMake will set archive UID/GID to -1/-1\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/CTest/CMP0145-Dart-WARN-stderr.txt b/Tests/RunCMake/CTest/CMP0145-Dart-WARN-stderr.txt index b8b5f3581a..af5d60bb9e 100644 --- a/Tests/RunCMake/CTest/CMP0145-Dart-WARN-stderr.txt +++ b/Tests/RunCMake/CTest/CMP0145-Dart-WARN-stderr.txt @@ -7,15 +7,16 @@ Call Stack \(most recent call first\): This warning is for project developers\. Use -Wno-author or -Wno-policy to suppress it\. + -CMake Warning \(author\) at [^ -]*/Modules/Dart\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at [^ +]*/Modules/Dart\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0145 is not set: The Dart and FindDart modules are removed\. Run "cmake --help-policy CMP0145" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. Call Stack \(most recent call first\): CMP0145-Dart-WARN\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. + CMake Warning \(deprecated\) at [^ ]*/Modules/Dart\.cmake:[0-9]+ \(cmake_policy\): diff --git a/Tests/RunCMake/CheckModules/CMP0075-stderr.txt b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt index a0ed60d90d..de84f4c80b 100644 --- a/Tests/RunCMake/CheckModules/CMP0075-stderr.txt +++ b/Tests/RunCMake/CheckModules/CMP0075-stderr.txt @@ -1,5 +1,5 @@ -^CMake Warning \(author\) at [^ -]*/Modules/CheckIncludeFile\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at [^ +]*/Modules/CheckIncludeFile\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0075 is not set: Include file check macros honor CMAKE_REQUIRED_LIBRARIES\. Run "cmake --help-policy CMP0075" for policy details\. Use the cmake_policy command to set the policy and suppress this @@ -13,10 +13,11 @@ Call Stack \(most recent call first\): CMP0075\.cmake:11 \(check_include_file\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. + -CMake Warning \(author\) at [^ -]*/Modules/CheckIncludeFileCXX\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at [^ +]*/Modules/CheckIncludeFileCXX\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0075 is not set: Include file check macros honor CMAKE_REQUIRED_LIBRARIES\. Run "cmake --help-policy CMP0075" for policy details\. Use the cmake_policy command to set the policy and suppress this @@ -30,10 +31,11 @@ CMake Warning \(author\) at [^ Call Stack \(most recent call first\): CMP0075\.cmake:26 \(check_include_file_cxx\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. + -CMake Warning \(author\) at [^ -]*/Modules/CheckIncludeFiles\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at [^ +]*/Modules/CheckIncludeFiles\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0075 is not set: Include file check macros honor CMAKE_REQUIRED_LIBRARIES\. Run "cmake --help-policy CMP0075" for policy details\. Use the cmake_policy command to set the policy and suppress this @@ -47,7 +49,8 @@ CMake Warning \(author\) at [^ Call Stack \(most recent call first\): CMP0075\.cmake:41 \(check_include_files\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. + CMake Warning \(deprecated\) at CMP0075\.cmake:[0-9]+ \(cmake_policy\): The OLD behavior for policy CMP0075 will be removed from a future version diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt index e168269338..7479f1c3fc 100644 --- a/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-CMP0114-WARN-stderr.txt @@ -1,5 +1,5 @@ -^CMake Warning \(author\) at [^ -]*/Modules/ExternalProject\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at [^ +]*/Modules/ExternalProject\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0114 is not set: ExternalProject step targets fully adopt their steps\. Run "cmake --help-policy CMP0114" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. @@ -17,7 +17,8 @@ Call Stack \(most recent call first\): NO_DEPENDS-CMP0114-Common\.cmake:[0-9]+ \(ExternalProject_Add\) NO_DEPENDS-CMP0114-WARN\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. + CMake Warning \(author\) at [^ ]*/Modules/ExternalProject\.cmake:[0-9]+ \(message\): @@ -53,8 +54,8 @@ Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers\. Use -Wno-author to suppress it\. + -CMake Warning \(author\) at [^ -]*/Modules/ExternalProject\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at [^ +]*/Modules/ExternalProject\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0114 is not set: ExternalProject step targets fully adopt their steps\. Run "cmake --help-policy CMP0114" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. @@ -72,7 +73,8 @@ Call Stack \(most recent call first\): NO_DEPENDS-CMP0114-Common\.cmake:[0-9]+ \(ExternalProject_Add\) NO_DEPENDS-CMP0114-WARN\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. + CMake Warning \(author\) at [^ ]*/Modules/ExternalProject\.cmake:[0-9]+ \(message\): @@ -91,8 +93,8 @@ Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) This warning is for project developers\. Use -Wno-author to suppress it\. + -CMake Warning \(author\) at [^ -]*/Modules/ExternalProject\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at [^ +]*/Modules/ExternalProject\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0114 is not set: ExternalProject step targets fully adopt their steps\. Run "cmake --help-policy CMP0114" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. @@ -105,7 +107,8 @@ Call Stack \(most recent call first\): NO_DEPENDS-CMP0114-Common\.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) NO_DEPENDS-CMP0114-WARN\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. + CMake Warning \(author\) at [^ ]*/Modules/ExternalProject\.cmake:[0-9]+ \(message\): diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stderr.txt index a4d3721c9e..ca25ca2b1d 100644 --- a/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stderr.txt +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryParentheses-CMP0183-WARN-stderr.txt @@ -1,9 +1,10 @@ -^CMake Warning \(author\) at [^ -]*/Modules/FeatureSummary\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at [^ +]*/Modules/FeatureSummary\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0183 is not set: add_feature_info\(\) supports full Condition Syntax\. Run "cmake --help-policy CMP0183" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. Call Stack \(most recent call first\): FeatureSummaryParentheses-CMP0183-WARN\.cmake:[0-9]+ \(add_feature_info\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt index ad60296d84..49e555fee4 100644 --- a/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt +++ b/Tests/RunCMake/FindOpenGL/CMP0072-WARN-stderr.txt @@ -1,4 +1,4 @@ -^CMake Warning \(author\) at .*/Modules/FindOpenGL\.cmake:[0-9]+ \(message\): +^CMake Warning \(policy\) at .*/Modules/FindOpenGL\.cmake:[0-9]+ \(cmake_policy\): 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\. @@ -18,4 +18,5 @@ Call Stack \(most recent call first\): CMP0072-common\.cmake:[0-9]+ \(find_package\) CMP0072-WARN\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/GoogleTest/Launcher-CMP0178-WARN-stderr.txt b/Tests/RunCMake/GoogleTest/Launcher-CMP0178-WARN-stderr.txt index 83050fcb49..258d0efd7b 100644 --- a/Tests/RunCMake/GoogleTest/Launcher-CMP0178-WARN-stderr.txt +++ b/Tests/RunCMake/GoogleTest/Launcher-CMP0178-WARN-stderr.txt @@ -1,5 +1,5 @@ -CMake Warning \(author\) at [^ -]*/Modules/GoogleTest\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at [^ +]*/Modules/GoogleTest\.cmake:[0-9]+ \(cmake_policy\): The 'launcher_test' target's TEST_LAUNCHER or CROSSCOMPILING_EMULATOR test properties contain one or more empty values\. Those empty values are being silently discarded to preserve backward compatibility\. @@ -11,10 +11,11 @@ Call Stack \(most recent call first\): Launcher\.cmake:[0-9]+ \(gtest_discover_tests\) Launcher-CMP0178-WARN\.cmake:1 \(include\) CMakeLists\.txt:3 \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. -CMake Warning \(author\) at [^ -]*/Modules/GoogleTest\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at [^ +]*/Modules/GoogleTest\.cmake:[0-9]+ \(cmake_policy\): The EXTRA_ARGS value contains one or more empty values\. Those empty values are being silently discarded to preserve backward compatibility\. @@ -25,7 +26,8 @@ Call Stack \(most recent call first\): Launcher\.cmake:[0-9]+ \(gtest_discover_tests\) Launcher-CMP0178-WARN\.cmake:1 \(include\) CMakeLists\.txt:3 \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\. +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\. CMake Warning \(policy\) in CMakeLists\.txt: The TEST_LAUNCHER property of target 'launcher_test' contains empty list diff --git a/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt index 291ff2b5c8..63052759b5 100644 --- a/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt +++ b/Tests/RunCMake/UseSWIG/CMP0078-WARN-stderr.txt @@ -1,10 +1,10 @@ -CMake Warning \(author\) at .*/Modules/UseSWIG\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at .*/Modules/UseSWIG\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0078 is not set: UseSWIG generates standard target names\. Run "cmake --help-policy CMP0078" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. - Call Stack \(most recent call first\): CMP0078-common\.cmake:8 \(swig_add_library\) CMP0078-WARN\.cmake:1 \(include\) CMakeLists\.txt:3 \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/UseSWIG/CMP0086-WARN-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0086-WARN-stderr.txt index bf52a349da..69739cdb8f 100644 --- a/Tests/RunCMake/UseSWIG/CMP0086-WARN-stderr.txt +++ b/Tests/RunCMake/UseSWIG/CMP0086-WARN-stderr.txt @@ -1,11 +1,11 @@ -CMake Warning \(author\) at .*/Modules/UseSWIG\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at .*/Modules/UseSWIG\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module flag\. Run "cmake --help-policy CMP0086" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. - Call Stack \(most recent call first\): .*/Modules/UseSWIG\.cmake:[0-9]+ \(SWIG_ADD_SOURCE_TO_MODULE\) CMP0086-common\.cmake:[0-9]+ \(swig_add_library\) CMP0086-WARN\.cmake:1 \(include\) CMakeLists\.txt:3 \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$ diff --git a/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt b/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt index 5c7dcb498e..9ca9cd7003 100644 --- a/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt +++ b/Tests/RunCMake/UseSWIG/CMP0122-WARN-stderr.txt @@ -1,10 +1,10 @@ -CMake Warning \(author\) at .*/Modules/UseSWIG\.cmake:[0-9]+ \(message\): +CMake Warning \(policy\) at .*/Modules/UseSWIG\.cmake:[0-9]+ \(cmake_policy\): Policy CMP0122 is not set: UseSWIG use standard library name conventions for csharp language\. Run "cmake --help-policy CMP0122" for policy details\. Use the cmake_policy command to set the policy and suppress this warning\. - Call Stack \(most recent call first\): CMP0122-common\.cmake:9 \(swig_add_library\) CMP0122-WARN\.cmake:1 \(include\) CMakeLists\.txt:3 \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ +This warning is for project developers\. Use -Wno-author or -Wno-policy to +suppress it\.$