diff options
author | Brad King <brad.king@kitware.com> | 2013-11-08 15:33:14 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-11-08 15:33:14 (GMT) |
commit | 2053e0cd51810d434ec4563186d5e2792d1c9cab (patch) | |
tree | 9941a15086825e24aac3d8b436ba5cd0398b83ec /Tests | |
parent | 064e6d32728a73edcf44d6b52572dbec19e0c90d (diff) | |
parent | 596b2a8c0820bed8195e2377927a18cf2d76727c (diff) | |
download | CMake-2053e0cd51810d434ec4563186d5e2792d1c9cab.zip CMake-2053e0cd51810d434ec4563186d5e2792d1c9cab.tar.gz CMake-2053e0cd51810d434ec4563186d5e2792d1c9cab.tar.bz2 |
Merge topic 'tll-target-policies'
596b2a8 Disallow linking to utility targets (#13902).
301bb5c Disallow link-to-self (#13947).
05f5fde Disallow invalid target names (#13140)
Diffstat (limited to 'Tests')
36 files changed, 216 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-result.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-stderr.txt new file mode 100644 index 0000000..6de96b1 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-stderr.txt @@ -0,0 +1,39 @@ +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-NEW.cmake b/Tests/RunCMake/CMP0037/CMP0037-NEW.cmake new file mode 100644 index 0000000..a6ffc59 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW.cmake @@ -0,0 +1,7 @@ + +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-OLD-result.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0037/CMP0037-OLD.cmake b/Tests/RunCMake/CMP0037/CMP0037-OLD.cmake new file mode 100644 index 0000000..af98f12 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-OLD.cmake @@ -0,0 +1,5 @@ + +cmake_policy(SET CMP0037 OLD) + +add_library("lib with spaces" empty.cpp) +add_executable("exe with spaces" empty.cpp) diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-result.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0037/CMP0037-WARN-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-WARN-stderr.txt new file mode 100644 index 0000000..e7a9e1d --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN-stderr.txt @@ -0,0 +1,43 @@ +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/CMP0037-WARN.cmake b/Tests/RunCMake/CMP0037/CMP0037-WARN.cmake new file mode 100644 index 0000000..2beaad0 --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMP0037-WARN.cmake @@ -0,0 +1,5 @@ + +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/CMakeLists.txt b/Tests/RunCMake/CMP0037/CMakeLists.txt new file mode 100644 index 0000000..f1d9cae --- /dev/null +++ b/Tests/RunCMake/CMP0037/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake new file mode 100644 index 0000000..e983526 --- /dev/null +++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0037-NEW) +run_cmake(CMP0037-OLD) +run_cmake(CMP0037-WARN) diff --git a/Tests/RunCMake/CMP0037/empty.cpp b/Tests/RunCMake/CMP0037/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0037/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt b/Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt new file mode 100644 index 0000000..3d0a428 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-NEW-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CMP0038-NEW.cmake:3 \(add_library\): + Target "self_link" links to itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake b/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake new file mode 100644 index 0000000..6296b83 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-NEW.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0038 NEW) +add_library(self_link empty.cpp) +target_link_libraries(self_link self_link) diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake b/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake new file mode 100644 index 0000000..3752821 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-OLD.cmake @@ -0,0 +1,4 @@ + +cmake_policy(SET CMP0038 OLD) +add_library(self_link empty.cpp) +target_link_libraries(self_link self_link) diff --git a/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt b/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt b/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt new file mode 100644 index 0000000..64631e7 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-WARN-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMP0038-WARN.cmake:2 \(add_library\): + Policy CMP0038 is not set: Targets may not link directly to themselves. + Run "cmake --help-policy CMP0038" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Target "self_link" links to itself. +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/CMP0038/CMP0038-WARN.cmake b/Tests/RunCMake/CMP0038/CMP0038-WARN.cmake new file mode 100644 index 0000000..5b92d09 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMP0038-WARN.cmake @@ -0,0 +1,3 @@ + +add_library(self_link empty.cpp) +target_link_libraries(self_link self_link) diff --git a/Tests/RunCMake/CMP0038/CMakeLists.txt b/Tests/RunCMake/CMP0038/CMakeLists.txt new file mode 100644 index 0000000..2f10cb0 --- /dev/null +++ b/Tests/RunCMake/CMP0038/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0038/RunCMakeTest.cmake b/Tests/RunCMake/CMP0038/RunCMakeTest.cmake new file mode 100644 index 0000000..fc3500a --- /dev/null +++ b/Tests/RunCMake/CMP0038/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0038-WARN) +run_cmake(CMP0038-NEW) +run_cmake(CMP0038-OLD) diff --git a/Tests/RunCMake/CMP0038/empty.cpp b/Tests/RunCMake/CMP0038/empty.cpp new file mode 100644 index 0000000..bfbbdde --- /dev/null +++ b/Tests/RunCMake/CMP0038/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int empty() +{ + return 0; +} diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt b/Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt new file mode 100644 index 0000000..1496c05 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at CMP0039-NEW.cmake:7 \(target_link_libraries\): + Policy CMP0039 is not set: Utility targets may not have link dependencies + Run "cmake --help-policy CMP0039" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Utility target "utility" must not be used as the target of a + target_link_libraries call. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake b/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake new file mode 100644 index 0000000..2032d64 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-NEW.cmake @@ -0,0 +1,7 @@ + +cmake_policy(SET CMP0039 NEW) + +add_custom_target(utility + COMMAND ${CMAKE_COMMAND} -E echo test +) +target_link_libraries(utility m) diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake b/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake new file mode 100644 index 0000000..9a513f4 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-OLD.cmake @@ -0,0 +1,7 @@ + +cmake_policy(SET CMP0039 OLD) + +add_custom_target(utility + COMMAND ${CMAKE_COMMAND} -E echo test +) +target_link_libraries(utility m) diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt b/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt new file mode 100644 index 0000000..9387f8c --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-WARN-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at CMP0039-WARN.cmake:5 \(target_link_libraries\): + Policy CMP0039 is not set: Utility targets may not have link dependencies + Run "cmake --help-policy CMP0039" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Utility target "utility" should not be used as the target of a + target_link_libraries call. +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/CMP0039/CMP0039-WARN.cmake b/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake new file mode 100644 index 0000000..6249993 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMP0039-WARN.cmake @@ -0,0 +1,5 @@ + +add_custom_target(utility + COMMAND ${CMAKE_COMMAND} -E echo test +) +target_link_libraries(utility m) diff --git a/Tests/RunCMake/CMP0039/CMakeLists.txt b/Tests/RunCMake/CMP0039/CMakeLists.txt new file mode 100644 index 0000000..2f10cb0 --- /dev/null +++ b/Tests/RunCMake/CMP0039/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/CMP0039/RunCMakeTest.cmake b/Tests/RunCMake/CMP0039/RunCMakeTest.cmake new file mode 100644 index 0000000..58e8ea9 --- /dev/null +++ b/Tests/RunCMake/CMP0039/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0039-WARN) +run_cmake(CMP0039-NEW) +run_cmake(CMP0039-OLD) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 99a0fb3..6e72e70 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -56,6 +56,11 @@ 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(CMP0038) +add_RunCMake_test(CMP0039) add_RunCMake_test(CTest) if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange) |