summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-11-14 16:28:12 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-11-14 16:28:12 (GMT)
commit15872a3c3038368784e43074ea0b9539b3e03bfb (patch)
tree0f18bc3547704cf1b6340e092be0d403da8f51f1 /Tests
parent42eaf3416890ca6fc4462c112492bb740e943525 (diff)
parentbf755c7c381d8d7d84578bf2dc4ac673aefa090a (diff)
downloadCMake-15872a3c3038368784e43074ea0b9539b3e03bfb.zip
CMake-15872a3c3038368784e43074ea0b9539b3e03bfb.tar.gz
CMake-15872a3c3038368784e43074ea0b9539b3e03bfb.tar.bz2
Merge topic 'set_emptyvar_PARENT_SCOPE'
bf755c7 set: Add unit tests for set/unset PARENT_SCOPE bc280f1 set: Fix handling of empty value with PARENT_SCOPE 20afbd5 set: Handle value-less PARENT_SCOPE explicitly
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/set/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/set/PARENT_SCOPE-result.txt1
-rw-r--r--Tests/RunCMake/set/PARENT_SCOPE.cmake33
-rw-r--r--Tests/RunCMake/set/RunCMakeTest.cmake3
5 files changed, 41 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index bf3dcc1..bb1b909 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -107,6 +107,7 @@ add_RunCMake_test(list)
add_RunCMake_test(message)
add_RunCMake_test(string)
add_RunCMake_test(try_compile)
+add_RunCMake_test(set)
add_RunCMake_test(variable_watch)
add_RunCMake_test(CMP0004)
add_RunCMake_test(TargetPolicies)
diff --git a/Tests/RunCMake/set/CMakeLists.txt b/Tests/RunCMake/set/CMakeLists.txt
new file mode 100644
index 0000000..4b3de84
--- /dev/null
+++ b/Tests/RunCMake/set/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/set/PARENT_SCOPE-result.txt b/Tests/RunCMake/set/PARENT_SCOPE-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/set/PARENT_SCOPE-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/set/PARENT_SCOPE.cmake b/Tests/RunCMake/set/PARENT_SCOPE.cmake
new file mode 100644
index 0000000..9bd6bca
--- /dev/null
+++ b/Tests/RunCMake/set/PARENT_SCOPE.cmake
@@ -0,0 +1,33 @@
+set(FOO )
+set(BAR "bar")
+set(BAZ "baz")
+set(BOO "boo")
+
+function(_parent_scope)
+ set(FOO "foo" PARENT_SCOPE)
+ set(BAR "" PARENT_SCOPE)
+ set(BAZ PARENT_SCOPE)
+ unset(BOO PARENT_SCOPE)
+endfunction()
+
+_parent_scope()
+
+if(NOT DEFINED FOO)
+ message(FATAL_ERROR "FOO not defined")
+elseif(NOT "${FOO}" STREQUAL "foo")
+ message(FATAL_ERROR "FOO should be \"foo\", not \"${FOO}\"")
+endif()
+
+if(NOT DEFINED BAR)
+ message(FATAL_ERROR "BAR not defined")
+elseif(NOT "${BAR}" STREQUAL "")
+ message(FATAL_ERROR "BAR should be an empty string, not \"${BAR}\"")
+endif()
+
+if(DEFINED BAZ)
+ message(FATAL_ERROR "BAZ defined")
+endif()
+
+if(DEFINED BOO)
+ message(FATAL_ERROR "BOO defined")
+endif()
diff --git a/Tests/RunCMake/set/RunCMakeTest.cmake b/Tests/RunCMake/set/RunCMakeTest.cmake
new file mode 100644
index 0000000..5d036e3
--- /dev/null
+++ b/Tests/RunCMake/set/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(PARENT_SCOPE)