summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/include_guard/DirectoryScope.cmake
diff options
context:
space:
mode:
authorPavel Solodovnikov <hellyeahdominate@gmail.com>2017-06-22 08:13:26 (GMT)
committerPavel Solodovnikov <hellyeahdominate@gmail.com>2017-06-22 08:13:26 (GMT)
commitc96f43b7dd1d41379fe63b4e8b508b2b034520b6 (patch)
tree822a5c6eeb9b26fb1ddc723c8de43685b196b9e8 /Tests/RunCMake/include_guard/DirectoryScope.cmake
parent80f1221f5088bb7ea7864a819c36d03e96f21155 (diff)
downloadCMake-c96f43b7dd1d41379fe63b4e8b508b2b034520b6.zip
CMake-c96f43b7dd1d41379fe63b4e8b508b2b034520b6.tar.gz
CMake-c96f43b7dd1d41379fe63b4e8b508b2b034520b6.tar.bz2
include_guard: add tests for the feature
Diffstat (limited to 'Tests/RunCMake/include_guard/DirectoryScope.cmake')
-rw-r--r--Tests/RunCMake/include_guard/DirectoryScope.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/include_guard/DirectoryScope.cmake b/Tests/RunCMake/include_guard/DirectoryScope.cmake
new file mode 100644
index 0000000..d6c5a3c
--- /dev/null
+++ b/Tests/RunCMake/include_guard/DirectoryScope.cmake
@@ -0,0 +1,19 @@
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Scripts")
+
+# Test include_guard with DIRECTORY scope
+
+# Add subdirectory which includes DirScript three times:
+# 1. Include at inner function scope
+# 2. At directory scope
+# 3. At another subdirectory to check that the guard is checked
+# against parent directories
+add_subdirectory(sub_dir_script1)
+# Add another directory which includes DirScript
+add_subdirectory(sub_dir_script2)
+
+# check inclusions count
+get_property(dir_count GLOBAL PROPERTY DIR_SCRIPT_COUNT)
+if(NOT dir_count EQUAL 2)
+ message(FATAL_ERROR
+ "Wrong DIR_SCRIPT_COUNT value: ${dir_count}, expected: 2")
+endif()