From 3092b14ed0c6f468f1c7499b987232a6528e5a59 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Feb 2023 14:00:00 -0500 Subject: Tests: Teach RunCMake to optionally ignore policy version deprecation warnings Avoid requiring tests for deprecated behavior to match the warnings explicitly. --- Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt | 6 ------ Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt | 11 ++--------- Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt | 9 +-------- Tests/RunCMake/CMP0019/RunCMakeTest.cmake | 1 + Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt | 6 ------ Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt | 6 ------ Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt | 6 ------ .../CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt | 6 ------ Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt | 6 ------ Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt | 9 +-------- Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt | 9 +-------- Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt | 6 ------ Tests/RunCMake/CMP0022/RunCMakeTest.cmake | 1 + Tests/RunCMake/RunCMake.cmake | 12 ++++++++++++ 14 files changed, 19 insertions(+), 75 deletions(-) delete mode 100644 Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt delete mode 100644 Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt diff --git a/Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt deleted file mode 100644 index 66a58fb..0000000 --- a/Tests/RunCMake/CMP0019/CMP0019-NEW-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt index a446211..dc03414 100644 --- a/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0019/CMP0019-OLD-stderr.txt @@ -1,13 +1,6 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions. -+ -CMake Deprecation Warning at CMP0019-OLD.cmake:[0-9]+ \(cmake_policy\): +^CMake Deprecation Warning at CMP0019-OLD\.cmake:[0-9]+ \(cmake_policy\): The OLD behavior for policy CMP0019 will be removed from a future version - of CMake. + of CMake\. The cmake-policies\(7\) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under diff --git a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt index f7b9c0e..6eee437 100644 --- a/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0019/CMP0019-WARN-stderr.txt @@ -1,11 +1,4 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions. -+ -CMake Warning \(dev\) in CMakeLists.txt: +^CMake Warning \(dev\) in CMakeLists\.txt: Policy CMP0019 is not set: Do not re-expand variables in include and link information. Run "cmake --help-policy CMP0019" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/CMP0019/RunCMakeTest.cmake b/Tests/RunCMake/CMP0019/RunCMakeTest.cmake index 119fc2b..fcd080f 100644 --- a/Tests/RunCMake/CMP0019/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0019/RunCMakeTest.cmake @@ -1,4 +1,5 @@ include(RunCMake) +set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON) run_cmake(CMP0019-WARN) run_cmake(CMP0019-OLD) diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt deleted file mode 100644 index 66a58fb..0000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-exe-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt deleted file mode 100644 index 66a58fb..0000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-shared-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt deleted file mode 100644 index 66a58fb..0000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-NEW-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt deleted file mode 100644 index 66a58fb..0000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt deleted file mode 100644 index 66a58fb..0000000 --- a/Tests/RunCMake/CMP0022/CMP0022-NOWARN-static-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt index 87404d3..c84a289 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-empty-old-stderr.txt @@ -1,11 +1,4 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions. -+ -CMake Warning \(dev\) in CMakeLists.txt: +^CMake Warning \(dev\) in CMakeLists\.txt: Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link interface. Run "cmake --help-policy CMP0022" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt index 5d75720..39a9511 100644 --- a/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0022/CMP0022-WARN-stderr.txt @@ -1,11 +1,4 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions. -+ -CMake Warning \(dev\) in CMakeLists.txt: +^CMake Warning \(dev\) in CMakeLists\.txt: Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link interface. Run "cmake --help-policy CMP0022" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt b/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt deleted file mode 100644 index 66a58fb..0000000 --- a/Tests/RunCMake/CMP0022/CMP0022-export-exe-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -^CMake Deprecation Warning at CMakeLists.txt:1 \(cmake_minimum_required\): - Compatibility with CMake < 2.8.12 will be removed from a future version of - CMake. - - Update the VERSION argument value or use a ... suffix to tell - CMake that the project does not need compatibility with older versions.$ diff --git a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake index 4c10996..ea956fc 100644 --- a/Tests/RunCMake/CMP0022/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0022/RunCMakeTest.cmake @@ -1,4 +1,5 @@ include(RunCMake) +set(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION ON) run_cmake(CMP0022-WARN) run_cmake(CMP0022-WARN-tll) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 54d7eb5..cfc84ca 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -186,6 +186,18 @@ function(run_cmake test) "|[^\n]*Bullseye Testing Technology" ")[^\n]*\n)+" ) + if(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION) + string(REGEX REPLACE [[ +^CMake Deprecation Warning at [^ +]*CMakeLists.txt:1 \(cmake_minimum_required\): + Compatibility with CMake < 2\.8\.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a \.\.\. suffix to tell + CMake that the project does not need compatibility with older versions\. ++ +]] "" actual_stderr "${actual_stderr}") + endif() foreach(o IN ITEMS stdout stderr config) string(REGEX REPLACE "\r\n" "\n" actual_${o} "${actual_${o}}") string(REGEX REPLACE "${ignore_line_regex}" "\\1" actual_${o} "${actual_${o}}") -- cgit v0.12