summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/set/ParentScope.cmake
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-04-06 21:53:52 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-04-06 21:58:35 (GMT)
commitc869984ea013f99c3104abaf17d553b08c4b17c2 (patch)
treee8fa541a6f888b432fbc1212bc9b05b183c583ee /Tests/RunCMake/set/ParentScope.cmake
parent5376151aa1d724b6d7ddef8d2e521d97cbfa74ae (diff)
downloadCMake-c869984ea013f99c3104abaf17d553b08c4b17c2.zip
CMake-c869984ea013f99c3104abaf17d553b08c4b17c2.tar.gz
CMake-c869984ea013f99c3104abaf17d553b08c4b17c2.tar.bz2
RunCMake: Allow specifying the source dir and file to test.
This will allow decoupling the name of the test from the name and location of the source file under test, which means one source file can be used for multiple tests. Rename the PARENT_SCOPE test in RunCMake.set to not use a keyword of the if() command as a file name. As the filename is now used with an if condition, this causes a conflict.
Diffstat (limited to 'Tests/RunCMake/set/ParentScope.cmake')
-rw-r--r--Tests/RunCMake/set/ParentScope.cmake33
1 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/set/ParentScope.cmake b/Tests/RunCMake/set/ParentScope.cmake
new file mode 100644
index 0000000..9bd6bca
--- /dev/null
+++ b/Tests/RunCMake/set/ParentScope.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()