ENH: Improve strictness of Function test

The command "set(... PARENT_SCOPE)" should never affect the calling
scope.  This improves the Function test to check that such calls in a
subdirectory scope affect the parent but not the child.
This commit is contained in:
Brad King 2009-07-22 13:42:27 -04:00
parent c64b1456b6
commit 267085f338
1 changed files with 14 additions and 4 deletions

View File

@ -1,4 +1,14 @@
SET(SUBDIR_DEFINED 1)
SET(SUBDIR_UNDEFINED)
SET(SUBDIR_DEFINED ${SUBDIR_DEFINED} PARENT_SCOPE)
SET(SUBDIR_UNDEFINED ${SUBDIR_UNDEFINED} PARENT_SCOPE)
SET(SUBDIR_DEFINED 1 PARENT_SCOPE)
SET(SUBDIR_UNDEFINED PARENT_SCOPE)
# The above sets should not affect the current scope.
IF(DEFINED SUBDIR_UNDEFINED)
PASS("SubdirScope Undefine Test" "(${SUBDIR_UNDEFINED})")
ELSE(DEFINED SUBDIR_UNDEFINED)
FAILED("SubdirScope Undefine Test" "(${SUBDIR_UNDEFINED})")
ENDIF(DEFINED SUBDIR_UNDEFINED)
IF(DEFINED SUBDIR_DEFINED)
FAILED("SubdirScope Define Test" "(${SUBDIR_DEFINED})")
ELSE(DEFINED SUBDIR_DEFINED)
PASS("SubdirScope Define Test" "(${SUBDIR_DEFINED})")
ENDIF(DEFINED SUBDIR_DEFINED)