diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 57d40ce373..deb338eb97 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2465,7 +2465,7 @@ if(BUILD_TESTING) --build-options "-DUNUSED_CLI_VARIABLE=Unused") set_tests_properties(WarnUnusedCliUnused PROPERTIES - PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE") + PASS_REGULAR_EXPRESSION "CMake Warning \\(unused-cli\\):.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused") add_test(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND} diff --git a/Tests/CMakeTests/MessageTest.cmake.in b/Tests/CMakeTests/MessageTest.cmake.in index a9833b99c9..4b8489d2b3 100644 --- a/Tests/CMakeTests/MessageTest.cmake.in +++ b/Tests/CMakeTests/MessageTest.cmake.in @@ -25,6 +25,6 @@ if(NOT "${err}" MATCHES "CMake Warning at[^\n]*:\r?\n message-warning") message(FATAL_ERROR "message(WARNING) did not appear properly") endif() -if(NOT "${err}" MATCHES "CMake Warning \\(dev\\) at[^\n]*:\r?\n message-author") +if(NOT "${err}" MATCHES "CMake Warning \\(author\\) at[^\n]*:\r?\n message-author") message(FATAL_ERROR "message(AUTHOR_WARNING) did not appear properly") endif() diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index c1a4bae5b5..87f6d1b277 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -435,9 +435,10 @@ if(EP_TEST_GIT) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") set(proj TS1-GIT-all-GIT_SUBMODULES-via-CMP0097-OLD) - set(CMAKE_WARN_DEPRECATED FALSE) # we are testing CMP0097 OLD behavior + cmake_diagnostic(PUSH) + cmake_diagnostic(SET CMD_DEPRECATED IGNORE) cmake_policy(SET CMP0097 OLD) - unset(CMAKE_WARN_DEPRECATED) + cmake_diagnostic(POP) ExternalProject_Add(${proj} GIT_REPOSITORY "${local_git_repo}" GIT_SUBMODULES "" diff --git a/Tests/RunCMake/CMakePresets/ErrorDeprecated-stderr.txt b/Tests/RunCMake/CMakePresets/ErrorDeprecated-stderr.txt index 964a5042f3..f182d46124 100644 --- a/Tests/RunCMake/CMakePresets/ErrorDeprecated-stderr.txt +++ b/Tests/RunCMake/CMakePresets/ErrorDeprecated-stderr.txt @@ -1,4 +1,4 @@ -^CMake Deprecation Error at [^ +^CMake Error \(deprecated\) at [^ ]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): Deprecation warning Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CMakePresets/ErrorDev-stderr.txt b/Tests/RunCMake/CMakePresets/ErrorDev-stderr.txt index 4537246373..569c364e8f 100644 --- a/Tests/RunCMake/CMakePresets/ErrorDev-stderr.txt +++ b/Tests/RunCMake/CMakePresets/ErrorDev-stderr.txt @@ -1,13 +1,13 @@ -^CMake Error \(dev\) at [^ +^CMake Error \(author\) at [^ ]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): Dev warning Call Stack \(most recent call first\): [^ ]*/Tests/RunCMake/CMakePresets/ErrorDev\.cmake:[0-9]+ \(include\) CMakeLists\.txt:[0-9]+ \(include\) -This error is for project developers\. Use -Wno-error=dev to suppress it\. +This error is for project developers\. Use -Wno-error=author to suppress it\. -CMake Deprecation Error at [^ +CMake Error \(deprecated\) at [^ ]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): Deprecation warning Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CMakePresets/ErrorUninitialized-stderr.txt b/Tests/RunCMake/CMakePresets/ErrorUninitialized-stderr.txt index dd4430f8ca..6d9315ee93 100644 --- a/Tests/RunCMake/CMakePresets/ErrorUninitialized-stderr.txt +++ b/Tests/RunCMake/CMakePresets/ErrorUninitialized-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning: +CMake Warning \(unused-cli\): Manually-specified variables were not used by the project: RunCMake_GENERATOR diff --git a/Tests/RunCMake/CMakePresets/ErrorUnusedCli-stderr.txt b/Tests/RunCMake/CMakePresets/ErrorUnusedCli-stderr.txt index 0b479ff59c..676a111c9a 100644 --- a/Tests/RunCMake/CMakePresets/ErrorUnusedCli-stderr.txt +++ b/Tests/RunCMake/CMakePresets/ErrorUnusedCli-stderr.txt @@ -1,4 +1,4 @@ -CMake Error: +CMake Error \(unused-cli\): Manually-specified variables were not used by the project: RunCMake_GENERATOR diff --git a/Tests/RunCMake/CMakePresets/NoWarningFlags-stderr.txt b/Tests/RunCMake/CMakePresets/NoWarningFlags-stderr.txt index 3844ad3ba6..6e717ed926 100644 --- a/Tests/RunCMake/CMakePresets/NoWarningFlags-stderr.txt +++ b/Tests/RunCMake/CMakePresets/NoWarningFlags-stderr.txt @@ -16,7 +16,7 @@ Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) -CMake Warning: +CMake Warning \(unused-cli\): Manually-specified variables were not used by the project: RunCMake_GENERATOR diff --git a/Tests/RunCMake/CMakePresets/WarningFlags-stderr.txt b/Tests/RunCMake/CMakePresets/WarningFlags-stderr.txt index 0ca0c924e9..15da2cdf4e 100644 --- a/Tests/RunCMake/CMakePresets/WarningFlags-stderr.txt +++ b/Tests/RunCMake/CMakePresets/WarningFlags-stderr.txt @@ -1,11 +1,11 @@ -^CMake Warning \(author\) at [^ +^CMake Warning \(uninitialized\) at [^ ]*/Modules/[^/ ]*:[0-9]+ \([a-zA-Z_][a-zA-Z0-9_]*\): uninitialized variable '[^ ]*' Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(project\) -This warning is for project developers\. Use -Wno-author to suppress it\..* + CMakeLists\.txt:[0-9]+ \(project\)( +This warning is for project developers\. Use -Wno-author to suppress it\.)?.* CMake Warning \(author\) at [^ ]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(message\): Dev warning @@ -24,11 +24,11 @@ Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) -CMake Warning \(author\) at [^ +CMake Warning \(uninitialized\) at [^ ]*/Tests/RunCMake/CMakePresets/WarningsBase\.cmake:[0-9]+ \(set\): uninitialized variable 'UNINITIALIZED_VARIABLE' Call Stack \(most recent call first\): [^ ]*/Tests/RunCMake/CMakePresets/WarningFlags\.cmake:[0-9]+ \(include\) - CMakeLists\.txt:[0-9]+ \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ + CMakeLists\.txt:[0-9]+ \(include\)( +This warning is for project developers\. Use -Wno-author to suppress it\.)?$ diff --git a/Tests/RunCMake/CommandLine/Werror_author-stderr.txt b/Tests/RunCMake/CommandLine/Werror_author-stderr.txt index f6fdcd669b..29e0dbfd61 100644 --- a/Tests/RunCMake/CommandLine/Werror_author-stderr.txt +++ b/Tests/RunCMake/CommandLine/Werror_author-stderr.txt @@ -1,11 +1,11 @@ -^CMake Error \(dev\) at Werror_author\.cmake:4 \(include\): +^CMake Error \(author\) at Werror_author\.cmake:4 \(include\): include\(\) given empty file name \(ignored\)\. Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) -This error is for project developers\. Use -Wno-error=dev to suppress it\. +This error is for project developers\. Use -Wno-error=author to suppress it\. -CMake Error \(dev\) at Werror_author\.cmake:7 \(message\): +CMake Error \(author\) at Werror_author\.cmake:7 \(message\): Some author warning Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) -This error is for project developers\. Use -Wno-error=dev to suppress it\.$ +This error is for project developers\. Use -Wno-error=author to suppress it\.$ diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt index e60b54943a..3bbac473ee 100644 --- a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt +++ b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt @@ -1,4 +1,4 @@ -^CMake Deprecation Error at Werror_deprecated\.cmake:1 \(message\): +^CMake Error \(deprecated\) at Werror_deprecated\.cmake:1 \(message\): Some deprecated warning Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CommandLine/Wuninitialized-stderr.txt b/Tests/RunCMake/CommandLine/Wuninitialized-stderr.txt index 9d54750071..9490c81bfa 100644 --- a/Tests/RunCMake/CommandLine/Wuninitialized-stderr.txt +++ b/Tests/RunCMake/CommandLine/Wuninitialized-stderr.txt @@ -1,23 +1,23 @@ -CMake Warning \(author\) at Wuninitialized\.cmake:1 \(set\): +CMake Warning \(uninitialized\) at Wuninitialized\.cmake:1 \(set\): uninitialized variable 'NEW_WARN_FROM_NORMAL_CMAKE_FILE_INSIDE_BRACES' Call Stack \(most recent call first\): 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 to suppress it\.)? -CMake Warning \(author\) at Wuninitialized\.cmake:2 \(string\): +CMake Warning \(uninitialized\) at Wuninitialized\.cmake:2 \(string\): uninitialized variable 'NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_BRACES' Call Stack \(most recent call first\): 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 to suppress it\.)? -CMake Warning \(author\) at Wuninitialized\.cmake:4 \(configure_file\): +CMake Warning \(uninitialized\) at Wuninitialized\.cmake:4 \(configure_file\): uninitialized variable 'NEW_WARN_FROM_CONFIGURE_FILE_INSIDE_AT' Call Stack \(most recent call first\): 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 to suppress it\.)? -CMake Warning \(author\) at Wuninitialized\.cmake:5 \(string\): +CMake Warning \(uninitialized\) at Wuninitialized\.cmake:5 \(string\): uninitialized variable 'NEW_WARN_FROM_STRING_CONFIGURE_INSIDE_AT' Call Stack \(most recent call first\): - CMakeLists\.txt:3 \(include\) -This warning is for project developers\. Use -Wno-author to suppress it\.$ + CMakeLists\.txt:3 \(include\)( +This warning is for project developers\. Use -Wno-author to suppress it\.)?$ diff --git a/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN.cmake b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN.cmake index c0c64a5b74..aea9c5d164 100644 --- a/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN.cmake +++ b/Tests/RunCMake/ObsoleteQtMacros/AutomocMacro-WARN.cmake @@ -1,7 +1,7 @@ find_package(Qt4 REQUIRED) -set(CMAKE_WARN_DEPRECATED 1) +cmake_diagnostic(SET CMD_DEPRECATED WARN) add_library(foo SHARED empty.cpp) qt4_automoc(foo_moc_srcs empty.cpp) diff --git a/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN.cmake b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN.cmake index e86a3723be..9bd3cc3d53 100644 --- a/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN.cmake +++ b/Tests/RunCMake/ObsoleteQtMacros/UseModulesMacro-WARN.cmake @@ -1,7 +1,7 @@ find_package(Qt4 REQUIRED) -set(CMAKE_WARN_DEPRECATED 1) +cmake_diagnostic(SET CMD_DEPRECATED WARN) add_library(foo SHARED empty.cpp) qt4_use_modules(foo LINK_PRIVATE Core) diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 05dd6a6cbd..786b49baf0 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -7,17 +7,8 @@ run_cmake(ConfigureLog) run_cmake(defaultmessage) run_cmake(nomessage) run_cmake(message-internal-warning) -# run_cmake(nomessage-internal-warning) -run_cmake(warnmessage) - -# TODO: We currently do not have a way to change diagnostic state in a way that -# is visible to internally issued diagnostic. This will be remedied when we -# switch to the new methods for issuing diagnostics, but for a brief window, -# this test will only pass if author warnings are disabled by command-line -# option. -set(RunCMake_TEST_OPTIONS -Wno-author) run_cmake(nomessage-internal-warning) -unset(RunCMake_TEST_OPTIONS) +run_cmake(warnmessage) # Have to explicitly give the command for the working dir to be honored set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY /) diff --git a/Tests/RunCMake/message/errormessage_deprecated-stderr.txt b/Tests/RunCMake/message/errormessage_deprecated-stderr.txt index 8744f72a90..1ca848b9fe 100644 --- a/Tests/RunCMake/message/errormessage_deprecated-stderr.txt +++ b/Tests/RunCMake/message/errormessage_deprecated-stderr.txt @@ -1,4 +1,4 @@ -^CMake Deprecation Error at errormessage_deprecated\.cmake:3 \(message\): +^CMake Error \(deprecated\) at errormessage_deprecated\.cmake:3 \(message\): This is a deprecation error Call Stack \(most recent call first\): CMakeLists\.txt:3 \(include\)$ diff --git a/Tests/RunCMake/message/errormessage_dev-stderr.txt b/Tests/RunCMake/message/errormessage_dev-stderr.txt index 2d8075a40a..c55dc793a5 100644 --- a/Tests/RunCMake/message/errormessage_dev-stderr.txt +++ b/Tests/RunCMake/message/errormessage_dev-stderr.txt @@ -1,5 +1,5 @@ -^CMake Error \(dev\) at errormessage_dev\.cmake:3 \(message\): +^CMake Error \(author\) at errormessage_dev\.cmake:3 \(message\): This is a author error Call Stack \(most recent call first\): CMakeLists\.txt:3 \(include\) -This error is for project developers\. Use -Wno-error=dev to suppress it\.$ +This error is for project developers\. Use -Wno-error=author to suppress it\.$ diff --git a/Tests/UseSWIG/LegacyConfiguration.cmake b/Tests/UseSWIG/LegacyConfiguration.cmake index 1acc05a4dc..23e1a64cc0 100644 --- a/Tests/UseSWIG/LegacyConfiguration.cmake +++ b/Tests/UseSWIG/LegacyConfiguration.cmake @@ -1,6 +1,6 @@ # Prevent deprecated warnings from new UseSWIG module -set (CMAKE_WARN_DEPRECATED FALSE) +cmake_diagnostic(SET CMD_DEPRECATED IGNORE) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE})