From 8c6c1f16c94318630a547425637fdbc34f86f1fc Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 8 Nov 2013 11:44:55 -0500 Subject: [PATCH] Enable RunCMake.CMP0037 test everywhere Split the test cases covering spaces and colons into separate units. Run the space cases everywhere. Disable the colon cases where they are known to fail. This approach increases platform coverage for the test and makes the known-failure logic as local as possible. No Makefile generator on Windows can generate targets with ':' in their name because the CMakeFiles/.dir directory cannot be created. Skip this part of the test on all Windows Make tools. --- ...esult.txt => CMP0037-NEW-colon-result.txt} | 0 .../CMP0037/CMP0037-NEW-colon-stderr.txt | 19 ++++++++ .../RunCMake/CMP0037/CMP0037-NEW-colon.cmake | 5 +++ .../CMP0037/CMP0037-NEW-space-result.txt | 1 + .../CMP0037/CMP0037-NEW-space-stderr.txt | 19 ++++++++ ...0037-NEW.cmake => CMP0037-NEW-space.cmake} | 2 - Tests/RunCMake/CMP0037/CMP0037-NEW-stderr.txt | 39 ----------------- ...esult.txt => CMP0037-OLD-space-result.txt} | 0 ...tderr.txt => CMP0037-OLD-space-stderr.txt} | 0 ...0037-OLD.cmake => CMP0037-OLD-space.cmake} | 0 ...sult.txt => CMP0037-WARN-colon-result.txt} | 0 .../CMP0037/CMP0037-WARN-colon-stderr.txt | 21 +++++++++ .../RunCMake/CMP0037/CMP0037-WARN-colon.cmake | 3 ++ .../CMP0037/CMP0037-WARN-space-result.txt | 1 + .../CMP0037/CMP0037-WARN-space-stderr.txt | 21 +++++++++ ...37-WARN.cmake => CMP0037-WARN-space.cmake} | 2 - .../RunCMake/CMP0037/CMP0037-WARN-stderr.txt | 43 ------------------- Tests/RunCMake/CMP0037/RunCMakeTest.cmake | 11 +++-- Tests/RunCMake/CMakeLists.txt | 4 +- 19 files changed, 99 insertions(+), 92 deletions(-) rename Tests/RunCMake/CMP0037/{CMP0037-NEW-result.txt => CMP0037-NEW-colon-result.txt} (100%) create mode 100644 Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt create mode 100644 Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake create mode 100644 Tests/RunCMake/CMP0037/CMP0037-NEW-space-result.txt create mode 100644 Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt rename Tests/RunCMake/CMP0037/{CMP0037-NEW.cmake => CMP0037-NEW-space.cmake} (61%) delete mode 100644 Tests/RunCMake/CMP0037/CMP0037-NEW-stderr.txt rename Tests/RunCMake/CMP0037/{CMP0037-OLD-result.txt => CMP0037-OLD-space-result.txt} (100%) rename Tests/RunCMake/CMP0037/{CMP0037-OLD-stderr.txt => CMP0037-OLD-space-stderr.txt} (100%) rename Tests/RunCMake/CMP0037/{CMP0037-OLD.cmake => CMP0037-OLD-space.cmake} (100%) rename Tests/RunCMake/CMP0037/{CMP0037-WARN-result.txt => CMP0037-WARN-colon-result.txt} (100%) create mode 100644 Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt create mode 100644 Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake create mode 100644 Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt create mode 100644 Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt rename Tests/RunCMake/CMP0037/{CMP0037-WARN.cmake => CMP0037-WARN-space.cmake} (54%) delete mode 100644 Tests/RunCMake/CMP0037/CMP0037-WARN-stderr.txt diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-result.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-result.txt similarity index 100% rename from Tests/RunCMake/CMP0037/CMP0037-NEW-result.txt rename to Tests/RunCMake/CMP0037/CMP0037-NEW-colon-result.txt diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt new file mode 100644 index 000000000..aadc7d769 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt @@ -0,0 +1,19 @@ +CMake Error at CMP0037-NEW-colon.cmake:4 \(add_library\): + Policy CMP0037 is not set: Target names should match a validity pattern. + Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The target name "lib:colon" is not valid for certain CMake features, such + as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at CMP0037-NEW-colon.cmake:5 \(add_executable\): + Policy CMP0037 is not set: Target names should match a validity pattern. + Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The target name "exe:colon" is not valid for certain CMake features, such + as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake new file mode 100644 index 000000000..5c564f37a --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon.cmake @@ -0,0 +1,5 @@ + +cmake_policy(SET CMP0037 NEW) + +add_library("lib:colon" empty.cpp) +add_executable("exe:colon" empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-result.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt new file mode 100644 index 000000000..169db8642 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt @@ -0,0 +1,19 @@ +CMake Error at CMP0037-NEW-space.cmake:4 \(add_library\): + Policy CMP0037 is not set: Target names should match a validity pattern. + Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The target name "lib with spaces" is not valid for certain CMake features, + such as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at CMP0037-NEW-space.cmake:5 \(add_executable\): + Policy CMP0037 is not set: Target names should match a validity pattern. + Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The target name "exe with spaces" is not valid for certain CMake features, + such as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake similarity index 61% rename from Tests/RunCMake/CMP0037/CMP0037-NEW.cmake rename to Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake index a6ffc592c..9e2faaa83 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space.cmake @@ -3,5 +3,3 @@ cmake_policy(SET CMP0037 NEW) add_library("lib with spaces" empty.cpp) add_executable("exe with spaces" empty.cpp) -add_library("lib:colon" empty.cpp) -add_executable("exe:colon" empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-stderr.txt deleted file mode 100644 index 6de96b1fa..000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-stderr.txt +++ /dev/null @@ -1,39 +0,0 @@ -CMake Error at CMP0037-NEW.cmake:4 \(add_library\): - Policy CMP0037 is not set: Target names should match a validity pattern. - Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The target name "lib with spaces" is not valid for certain CMake features, - such as generator expressions, and may result in undefined behavior. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ -CMake Error at CMP0037-NEW.cmake:5 \(add_executable\): - Policy CMP0037 is not set: Target names should match a validity pattern. - Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The target name "exe with spaces" is not valid for certain CMake features, - such as generator expressions, and may result in undefined behavior. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ -CMake Error at CMP0037-NEW.cmake:6 \(add_library\): - Policy CMP0037 is not set: Target names should match a validity pattern. - Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The target name "lib:colon" is not valid for certain CMake features, such - as generator expressions, and may result in undefined behavior. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -+ -CMake Error at CMP0037-NEW.cmake:7 \(add_executable\): - Policy CMP0037 is not set: Target names should match a validity pattern. - Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The target name "exe:colon" is not valid for certain CMake features, such - as generator expressions, and may result in undefined behavior. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-result.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-result.txt similarity index 100% rename from Tests/RunCMake/CMP0037/CMP0037-OLD-result.txt rename to Tests/RunCMake/CMP0037/CMP0037-OLD-space-result.txt diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt similarity index 100% rename from Tests/RunCMake/CMP0037/CMP0037-OLD-stderr.txt rename to Tests/RunCMake/CMP0037/CMP0037-OLD-space-stderr.txt diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake similarity index 100% rename from Tests/RunCMake/CMP0037/CMP0037-OLD.cmake rename to Tests/RunCMake/CMP0037/CMP0037-OLD-space.cmake diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-result.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt similarity index 100% rename from Tests/RunCMake/CMP0037/CMP0037-WARN-result.txt rename to Tests/RunCMake/CMP0037/CMP0037-WARN-colon-result.txt diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt new file mode 100644 index 000000000..c9366fa58 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon-stderr.txt @@ -0,0 +1,21 @@ +CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:2 \(add_library\): + Policy CMP0037 is not set: Target names should match a validity pattern. + Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The target name "lib:colon" is not valid for certain CMake features, such + as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0037-WARN-colon.cmake:3 \(add_executable\): + Policy CMP0037 is not set: Target names should match a validity pattern. + Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The target name "exe:colon" is not valid for certain CMake features, such + as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake new file mode 100644 index 000000000..17c815e3e --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-colon.cmake @@ -0,0 +1,3 @@ + +add_library("lib:colon" empty.cpp) +add_executable("exe:colon" empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt new file mode 100644 index 000000000..b29aad550 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-space-stderr.txt @@ -0,0 +1,21 @@ +CMake Warning \(dev\) at CMP0037-WARN-space.cmake:2 \(add_library\): + Policy CMP0037 is not set: Target names should match a validity pattern. + Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The target name "lib with spaces" is not valid for certain CMake features, + such as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0037-WARN-space.cmake:3 \(add_executable\): + Policy CMP0037 is not set: Target names should match a validity pattern. + Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The target name "exe with spaces" is not valid for certain CMake features, + such as generator expressions, and may result in undefined behavior. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake similarity index 54% rename from Tests/RunCMake/CMP0037/CMP0037-WARN.cmake rename to Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake index 2beaad02c..4a108287d 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN.cmake +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-space.cmake @@ -1,5 +1,3 @@ add_library("lib with spaces" empty.cpp) add_executable("exe with spaces" empty.cpp) -add_library("lib:colon" empty.cpp) -add_executable("exe:colon" empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-stderr.txt deleted file mode 100644 index e7a9e1d10..000000000 --- a/Tests/RunCMake/CMP0037/CMP0037-WARN-stderr.txt +++ /dev/null @@ -1,43 +0,0 @@ -CMake Warning \(dev\) at CMP0037-WARN.cmake:2 \(add_library\): - Policy CMP0037 is not set: Target names should match a validity pattern. - Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The target name "lib with spaces" is not valid for certain CMake features, - such as generator expressions, and may result in undefined behavior. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) at CMP0037-WARN.cmake:3 \(add_executable\): - Policy CMP0037 is not set: Target names should match a validity pattern. - Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The target name "exe with spaces" is not valid for certain CMake features, - such as generator expressions, and may result in undefined behavior. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) at CMP0037-WARN.cmake:4 \(add_library\): - Policy CMP0037 is not set: Target names should match a validity pattern. - Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The target name "lib:colon" is not valid for certain CMake features, such - as generator expressions, and may result in undefined behavior. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. -+ -CMake Warning \(dev\) at CMP0037-WARN.cmake:5 \(add_executable\): - Policy CMP0037 is not set: Target names should match a validity pattern. - Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - - The target name "exe:colon" is not valid for certain CMake features, such - as generator expressions, and may result in undefined behavior. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake index e98352690..fbb1788c5 100644 --- a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake @@ -1,5 +1,10 @@ include(RunCMake) -run_cmake(CMP0037-NEW) -run_cmake(CMP0037-OLD) -run_cmake(CMP0037-WARN) +run_cmake(CMP0037-OLD-space) +run_cmake(CMP0037-NEW-space) +run_cmake(CMP0037-WARN-space) +run_cmake(CMP0037-NEW-colon) + +if(NOT (WIN32 AND "${RunCMake_GENERATOR}" MATCHES "Make")) + run_cmake(CMP0037-WARN-colon) +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 6e72e700c..bf3dcc143 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -56,9 +56,7 @@ add_RunCMake_test(CMP0022) add_RunCMake_test(CMP0026) add_RunCMake_test(CMP0027) add_RunCMake_test(CMP0028) -if (NOT "${CMAKE_TEST_GENERATOR}" MATCHES "(MSYS|MinGW|NMake|Borland) Makefiles") - add_RunCMake_test(CMP0037) -endif() +add_RunCMake_test(CMP0037) add_RunCMake_test(CMP0038) add_RunCMake_test(CMP0039) add_RunCMake_test(CTest)