ENH: Added test for IF inside a FOREACH.
This commit is contained in:
parent
08f2876bb4
commit
3d3caacf9e
|
@ -160,6 +160,20 @@ SET(REMOVE_STRING a b c d e f)
|
|||
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)
|
||||
|
|
|
@ -801,6 +801,14 @@ int main()
|
|||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -160,6 +160,20 @@ SET(REMOVE_STRING a b c d e f)
|
|||
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)
|
||||
|
|
|
@ -801,6 +801,14 @@ int main()
|
|||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -160,6 +160,20 @@ SET(REMOVE_STRING a b c d e f)
|
|||
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)
|
||||
|
|
|
@ -801,6 +801,14 @@ int main()
|
|||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue