diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-06-22 08:13:26 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-06-22 08:13:26 (GMT) |
commit | c96f43b7dd1d41379fe63b4e8b508b2b034520b6 (patch) | |
tree | 822a5c6eeb9b26fb1ddc723c8de43685b196b9e8 /Tests/RunCMake/include_guard/VariableScope.cmake | |
parent | 80f1221f5088bb7ea7864a819c36d03e96f21155 (diff) | |
download | CMake-c96f43b7dd1d41379fe63b4e8b508b2b034520b6.zip CMake-c96f43b7dd1d41379fe63b4e8b508b2b034520b6.tar.gz CMake-c96f43b7dd1d41379fe63b4e8b508b2b034520b6.tar.bz2 |
include_guard: add tests for the feature
Diffstat (limited to 'Tests/RunCMake/include_guard/VariableScope.cmake')
-rw-r--r-- | Tests/RunCMake/include_guard/VariableScope.cmake | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Tests/RunCMake/include_guard/VariableScope.cmake b/Tests/RunCMake/include_guard/VariableScope.cmake new file mode 100644 index 0000000..7f8477d --- /dev/null +++ b/Tests/RunCMake/include_guard/VariableScope.cmake @@ -0,0 +1,24 @@ +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Scripts") + +# Test include_guard with VARIABLE scope +function(var_include_func) + # Include twice in the same scope + include(VarScript) + include(VarScript) + get_property(var_count GLOBAL PROPERTY VAR_SCRIPT_COUNT) + if(NOT var_count EQUAL 1) + message(FATAL_ERROR + "Wrong VAR_SCRIPT_COUNT value: ${var_count}, expected: 1") + endif() +endfunction() + +var_include_func() + +# Check again that include_guard has been reset +include(VarScript) + +get_property(var_count GLOBAL PROPERTY VAR_SCRIPT_COUNT) +if(NOT var_count EQUAL 2) + message(FATAL_ERROR + "Wrong VAR_SCRIPT_COUNT value: ${var_count}, expected: 2") +endif() |