diff options
Diffstat (limited to 'Tests/FunctionTest')
-rw-r--r-- | Tests/FunctionTest/CMakeLists.txt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Tests/FunctionTest/CMakeLists.txt b/Tests/FunctionTest/CMakeLists.txt index 2f62c27..ef55173 100644 --- a/Tests/FunctionTest/CMakeLists.txt +++ b/Tests/FunctionTest/CMakeLists.txt @@ -130,4 +130,39 @@ ELSE(DEFINED SUBDIR_DEFINED) FAILED("Subdir Define Test" "(${SUBDIR_DEFINED})") ENDIF(DEFINED SUBDIR_DEFINED) +# Test function-scoped directory. +FUNCTION(ADD_SUBDIR2 dir) + ADD_SUBDIRECTORY("${dir}" "${dir}2") + # The parent scope sets in the subdir should be visible here. + IF(DEFINED SUBDIR_UNDEFINED) + FAILED("Subdir Function Undefine Test 1" "(${SUBDIR_UNDEFINED})") + ELSE(DEFINED SUBDIR_UNDEFINED) + PASS("Subdir Function Undefine Test 1" "(${SUBDIR_UNDEFINED})") + ENDIF(DEFINED SUBDIR_UNDEFINED) + IF(DEFINED SUBDIR_DEFINED) + PASS("Subdir Function Define Test 1" "(${SUBDIR_DEFINED})") + ELSE(DEFINED SUBDIR_DEFINED) + FAILED("Subdir Function Define Test 1" "(${SUBDIR_DEFINED})") + ENDIF(DEFINED SUBDIR_DEFINED) +ENDFUNCTION(ADD_SUBDIR2) + +# Reset test variables. +SET(SUBDIR_UNDEFINED 1) +SET(SUBDIR_DEFINED) + +# Run test function. +ADD_SUBDIR2(SubDirScope) + +# The parent scope sets in the subdir should not be visible here. +IF(DEFINED SUBDIR_UNDEFINED) + PASS("Subdir Function Undefine Test 2" "(${SUBDIR_UNDEFINED})") +ELSE(DEFINED SUBDIR_UNDEFINED) + FAILED("Subdir Function Undefine Test 2" "(${SUBDIR_UNDEFINED})") +ENDIF(DEFINED SUBDIR_UNDEFINED) +IF(DEFINED SUBDIR_DEFINED) + FAILED("Subdir Function Define Test 2" "(${SUBDIR_DEFINED})") +ELSE(DEFINED SUBDIR_DEFINED) + PASS("Subdir Function Define Test 2" "(${SUBDIR_DEFINED})") +ENDIF(DEFINED SUBDIR_DEFINED) + ADD_EXECUTABLE(FunctionTest functionTest.c) |