summaryrefslogtreecommitdiffstats
path: root/Tests/ComplexOneConfig
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2006-09-22 15:49:56 (GMT)
committerKen Martin <ken.martin@kitware.com>2006-09-22 15:49:56 (GMT)
commita6e63f3a6120f5cd4e192b5ea7f95f6ef32e97bb (patch)
treee5873ca1af977287b5e23d36bca12230030a64ec /Tests/ComplexOneConfig
parent5e46232ad8f6667e1e9a62b11ce4524097ad085a (diff)
downloadCMake-a6e63f3a6120f5cd4e192b5ea7f95f6ef32e97bb.zip
CMake-a6e63f3a6120f5cd4e192b5ea7f95f6ef32e97bb.tar.gz
CMake-a6e63f3a6120f5cd4e192b5ea7f95f6ef32e97bb.tar.bz2
ENH: added test for elseif
Diffstat (limited to 'Tests/ComplexOneConfig')
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt39
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx6
-rw-r--r--Tests/ComplexOneConfig/cmTestConfigure.h.in3
3 files changed, 48 insertions, 0 deletions
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index 81ade76..3e5619f 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -271,6 +271,44 @@ ENDWHILE(while_var LESS 1000)
SET(SHOULD_BE_ZERO )
SET(SHOULD_BE_ONE 1)
+
+# test elseif functionality, the mess below tries to catch problem
+# of clauses being executed early or late etc
+set (RESULT 3)
+if (RESULT EQUAL 1)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+elseif (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+elseif (RESULT EQUAL 3)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ if (NOT ELSEIF_RESULT EQUAL 1)
+ set (ELSEIF_RESULT 2)
+ endif (NOT ELSEIF_RESULT EQUAL 1)
+ endif (RESULT EQUAL 2)
+elseif (RESULT EQUAL 4)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+else (RESULT EQUAL 1)
+ if (RESULT EQUAL 2)
+ set (ELSEIF_RESULT 1)
+ elseif (RESULT EQUAL 3)
+ set (ELSEIF_RESULT 1)
+ endif (RESULT EQUAL 2)
+endif (RESULT EQUAL 1)
+
+if (NOT ELSEIF_RESULT EQUAL 2)
+ set (ELSEIF_RESULT 0)
+endif (NOT ELSEIF_RESULT EQUAL 2)
+
#
# Configure file
# (plug vars to #define so that they can be tested)
@@ -303,6 +341,7 @@ IF(NOT STRING_REGEX_PASSED)
"STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")")
ENDIF(NOT STRING_REGEX_PASSED)
+
#
# Create the libs and the main exe
#
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index c4fc73b..759cfd9 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -444,6 +444,12 @@ int main()
cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
#endif
+#ifdef ELSEIF_RESULT
+ cmPassed("ELSEIF did work");
+#else
+ cmFailed("ELSEIF did not work");
+#endif
+
if(file2() != 1)
{
cmFailed("Call to file2 function from library failed.");
diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in
index c8600cb..0b1e181 100644
--- a/Tests/ComplexOneConfig/cmTestConfigure.h.in
+++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in
@@ -77,3 +77,6 @@
#define CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_MODULE_PREFIX}"
#define CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}"
+
+// test elseif
+#cmakedefine ELSEIF_RESULT