summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-01-22 14:50:37 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-01-22 14:50:49 (GMT)
commit15c573df4115ab1be01da118c91b4d942e9007d6 (patch)
tree1b053b88a918326e5f6ebf2c91e132474b0fd772 /Tests
parent39695f6fb316de2289636de483f52d53096ac41d (diff)
parent3ec82b713e51711df0c70f539aea62fc16dd3060 (diff)
downloadCMake-15c573df4115ab1be01da118c91b4d942e9007d6.zip
CMake-15c573df4115ab1be01da118c91b4d942e9007d6.tar.gz
CMake-15c573df4115ab1be01da118c91b4d942e9007d6.tar.bz2
Merge topic 'mark_as_advanced-without-cache'
3ec82b713e cmMarkAsAdvancedCommand: ignore variables which don't exist in the cache 701a5c60e0 cmake: avoid marking local or unused variables as advanced af158149e7 FindOpenSSL: do not mark a local variable as advanced 74f659f1f2 FindCurses: only mark CURSES_EXTRA_LIBRARY when it is used 7e2ae4e96d FindOpenGL: only mark declared cache variables as advanced 7cc02a0c29 FindLua: only mark LUA_MATH_LIBRARY as advanced if required 85cd26b8a6 FindBoost: only mark Boost_DIR as advanced if defined 338c7916ba CTest: avoid marking undeclared cache variables as advanced ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4150
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMP0102/CMP0102-Common.cmake2
-rw-r--r--Tests/RunCMake/CMP0102/CMP0102-NEW.cmake13
-rw-r--r--Tests/RunCMake/CMP0102/CMP0102-OLD.cmake18
-rw-r--r--Tests/RunCMake/CMP0102/CMP0102-WARN-Default.cmake16
-rw-r--r--Tests/RunCMake/CMP0102/CMP0102-WARN-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0102/CMP0102-WARN.cmake18
-rw-r--r--Tests/RunCMake/CMP0102/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0102/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
9 files changed, 87 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0102/CMP0102-Common.cmake b/Tests/RunCMake/CMP0102/CMP0102-Common.cmake
new file mode 100644
index 0000000..61fdad6
--- /dev/null
+++ b/Tests/RunCMake/CMP0102/CMP0102-Common.cmake
@@ -0,0 +1,2 @@
+
+mark_as_advanced(CMP0102_TEST_VARIABLE)
diff --git a/Tests/RunCMake/CMP0102/CMP0102-NEW.cmake b/Tests/RunCMake/CMP0102/CMP0102-NEW.cmake
new file mode 100644
index 0000000..bdf769f
--- /dev/null
+++ b/Tests/RunCMake/CMP0102/CMP0102-NEW.cmake
@@ -0,0 +1,13 @@
+
+cmake_policy(SET CMP0102 NEW)
+
+include (CMP0102-Common.cmake)
+get_property(is_type_set CACHE CMP0102_TEST_VARIABLE
+ PROPERTY TYPE SET)
+if (is_type_set)
+ get_property(type CACHE CMP0102_TEST_VARIABLE
+ PROPERTY TYPE)
+ message(FATAL_ERROR
+ "There is a cache entry for an undefined variable after "
+ "`mark_as_advanced`.")
+endif ()
diff --git a/Tests/RunCMake/CMP0102/CMP0102-OLD.cmake b/Tests/RunCMake/CMP0102/CMP0102-OLD.cmake
new file mode 100644
index 0000000..5c20dd3
--- /dev/null
+++ b/Tests/RunCMake/CMP0102/CMP0102-OLD.cmake
@@ -0,0 +1,18 @@
+
+cmake_policy(SET CMP0102 OLD)
+
+include (CMP0102-Common.cmake)
+get_property(is_type_set CACHE CMP0102_TEST_VARIABLE
+ PROPERTY TYPE SET)
+if (NOT is_type_set)
+ message(FATAL_ERROR
+ "There is a cache entry for an undefined variable after "
+ "`mark_as_advanced`.")
+endif ()
+get_property(type CACHE CMP0102_TEST_VARIABLE
+ PROPERTY TYPE)
+if (NOT type STREQUAL "UNINITIALIZED")
+ message(FATAL_ERROR
+ "The cache type for CMP0102_TEST_VARIABLE is not "
+ "UNINITIALIZED")
+endif ()
diff --git a/Tests/RunCMake/CMP0102/CMP0102-WARN-Default.cmake b/Tests/RunCMake/CMP0102/CMP0102-WARN-Default.cmake
new file mode 100644
index 0000000..d6ebe4d
--- /dev/null
+++ b/Tests/RunCMake/CMP0102/CMP0102-WARN-Default.cmake
@@ -0,0 +1,16 @@
+
+include (CMP0102-Common.cmake)
+get_property(is_type_set CACHE CMP0102_TEST_VARIABLE
+ PROPERTY TYPE SET)
+if (NOT is_type_set)
+ message(FATAL_ERROR
+ "There is a cache entry for an undefined variable after "
+ "`mark_as_advanced`.")
+endif ()
+get_property(type CACHE CMP0102_TEST_VARIABLE
+ PROPERTY TYPE)
+if (NOT type STREQUAL "UNINITIALIZED")
+ message(FATAL_ERROR
+ "The cache type for CMP0102_TEST_VARIABLE is not "
+ "UNINITIALIZED")
+endif ()
diff --git a/Tests/RunCMake/CMP0102/CMP0102-WARN-stderr.txt b/Tests/RunCMake/CMP0102/CMP0102-WARN-stderr.txt
new file mode 100644
index 0000000..bb56ec2
--- /dev/null
+++ b/Tests/RunCMake/CMP0102/CMP0102-WARN-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) at CMP0102-Common.cmake:2 \(mark_as_advanced\):
+ Policy CMP0102 is not set: The variable named "CMP0102_TEST_VARIABLE" is
+ not in the cache. This results in an empty cache entry which is no longer
+ created when policy CMP0102 is set to NEW. Run "cmake --help-policy
+ CMP0102" for policy details. Use the cmake_policy command to set the
+ policy and suppress this warning.
+Call Stack \(most recent call first\):
+ CMP0102-WARN.cmake:4 \(include\)
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0102/CMP0102-WARN.cmake b/Tests/RunCMake/CMP0102/CMP0102-WARN.cmake
new file mode 100644
index 0000000..e9a45f1
--- /dev/null
+++ b/Tests/RunCMake/CMP0102/CMP0102-WARN.cmake
@@ -0,0 +1,18 @@
+
+set(CMAKE_POLICY_WARNING_CMP0102 1)
+
+include (CMP0102-Common.cmake)
+get_property(is_type_set CACHE CMP0102_TEST_VARIABLE
+ PROPERTY TYPE SET)
+if (NOT is_type_set)
+ message(FATAL_ERROR
+ "There is a cache entry for an undefined variable after "
+ "`mark_as_advanced`.")
+endif ()
+get_property(type CACHE CMP0102_TEST_VARIABLE
+ PROPERTY TYPE)
+if (NOT type STREQUAL "UNINITIALIZED")
+ message(FATAL_ERROR
+ "The cache type for CMP0102_TEST_VARIABLE is not "
+ "UNINITIALIZED")
+endif ()
diff --git a/Tests/RunCMake/CMP0102/CMakeLists.txt b/Tests/RunCMake/CMP0102/CMakeLists.txt
new file mode 100644
index 0000000..ef2163c
--- /dev/null
+++ b/Tests/RunCMake/CMP0102/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.1)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0102/RunCMakeTest.cmake b/Tests/RunCMake/CMP0102/RunCMakeTest.cmake
new file mode 100644
index 0000000..9b5df74
--- /dev/null
+++ b/Tests/RunCMake/CMP0102/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(CMP0102-OLD)
+run_cmake(CMP0102-NEW)
+run_cmake(CMP0102-WARN)
+run_cmake(CMP0102-WARN-Default)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index d302fe3..cd6e9ae 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -115,6 +115,7 @@ if(CMAKE_SYSTEM_NAME MATCHES Darwin AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
endif()
add_RunCMake_test(CMP0069)
add_RunCMake_test(CMP0081)
+add_RunCMake_test(CMP0102)
# The test for Policy 65 requires the use of the
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode