diff options
author | Brad King <brad.king@kitware.com> | 2002-07-16 21:42:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2002-07-16 21:42:56 (GMT) |
commit | 3d3caacf9ec9f99cebcfaeb5ab105daa1046f945 (patch) | |
tree | 7ce557ef4bbce9d386c6db2d4065415642f79b7f /Tests/ComplexOneConfig | |
parent | 08f2876bb438d229388984b851e11bfaa86a6e24 (diff) | |
download | CMake-3d3caacf9ec9f99cebcfaeb5ab105daa1046f945.zip CMake-3d3caacf9ec9f99cebcfaeb5ab105daa1046f945.tar.gz CMake-3d3caacf9ec9f99cebcfaeb5ab105daa1046f945.tar.bz2 |
ENH: Added test for IF inside a FOREACH.
Diffstat (limited to 'Tests/ComplexOneConfig')
-rw-r--r-- | Tests/ComplexOneConfig/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/Executable/complex.cxx | 12 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/cmTestConfigure.h.in | 4 |
3 files changed, 28 insertions, 2 deletions
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 0549c6f..2d6de20 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -161,6 +161,20 @@ SET(removeVar1 c e) REMOVE(REMOVE_STRING ${removeVar1} f) # +# Test an IF inside a FOREACH. +# +FOREACH(x "a") + IF(1) + # Should always execute. + SET(IF_INSIDE_FOREACH_THEN_EXECUTED 1) + ELSE(1) + # Should never execute. + SET(IF_INSIDE_FOREACH_ELSE_EXECUTED 1) + ENDIF(1) +ENDFOREACH(x) + + +# # Configure file # (plug vars to #define so that they can be tested) # diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index e8885e5..c5969cb 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -799,8 +799,16 @@ int main() else { cmFailed("cmSystemTools::UpperCase is working"); - } - + } + + // ---------------------------------------------------------------------- + // Test if IF command inside a FOREACH works. +#if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) + cmPassed("IF inside a FOREACH block works"); +#else + cmFailed("IF inside a FOREACH block is broken"); +#endif + // ---------------------------------------------------------------------- // Summary diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in index f89b615..350a9c0 100644 --- a/Tests/ComplexOneConfig/cmTestConfigure.h.in +++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in @@ -60,3 +60,7 @@ // Test Remove command #define REMOVE_STRING "${REMOVE_STRING}" + +// Test IF inside FOREACH +#cmakedefine IF_INSIDE_FOREACH_THEN_EXECUTED +#cmakedefine IF_INSIDE_FOREACH_ELSE_EXECUTED |