From ed258d606b87dacc465dad73b04f1c3e270b627c Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Wed, 2 Sep 2015 16:38:19 -0400
Subject: Tests: Cover set_property for buildsystem directory properties

Extend the RunCMake.set_property test with cases covering buildsystem
directory properties:

* COMPILE_DEFINITIONS
* COMPILE_OPTIONS
* INCLUDE_DIRECTORIES

Also test a non-buildsystem property to document the equivalence
in behavior.
---
 Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt |  1 +
 Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake      |  1 +
 Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt     |  1 +
 Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake          |  1 +
 Tests/RunCMake/set_property/Common.cmake                   | 14 ++++++++++++++
 Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt |  1 +
 Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake      |  1 +
 Tests/RunCMake/set_property/USER_PROP-stdout.txt           |  1 +
 Tests/RunCMake/set_property/USER_PROP.cmake                |  1 +
 9 files changed, 22 insertions(+)

diff --git a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt
index 186fe99..dd5bae1 100644
--- a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt
+++ b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS-stdout.txt
@@ -1 +1,2 @@
 -- Target COMPILE_DEFINITIONS is 'a;b;c;d;;e'
+-- Directory COMPILE_DEFINITIONS is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake
index ec07ce9..f0c63bf 100644
--- a/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake
+++ b/Tests/RunCMake/set_property/COMPILE_DEFINITIONS.cmake
@@ -1,2 +1,3 @@
 include(Common.cmake)
 test_target_property(COMPILE_DEFINITIONS)
+test_directory_property(COMPILE_DEFINITIONS)
diff --git a/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt b/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt
index 65d6934..1a20501 100644
--- a/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt
+++ b/Tests/RunCMake/set_property/COMPILE_OPTIONS-stdout.txt
@@ -1 +1,2 @@
 -- Target COMPILE_OPTIONS is 'a;b;c;d;;e'
+-- Directory COMPILE_OPTIONS is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake b/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake
index da20ec8..75f0535 100644
--- a/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake
+++ b/Tests/RunCMake/set_property/COMPILE_OPTIONS.cmake
@@ -1,2 +1,3 @@
 include(Common.cmake)
 test_target_property(COMPILE_OPTIONS)
+test_directory_property(COMPILE_OPTIONS)
diff --git a/Tests/RunCMake/set_property/Common.cmake b/Tests/RunCMake/set_property/Common.cmake
index b359487..9d5e4f4 100644
--- a/Tests/RunCMake/set_property/Common.cmake
+++ b/Tests/RunCMake/set_property/Common.cmake
@@ -12,3 +12,17 @@ macro(test_target_property PROP)
   message(STATUS "Target ${PROP} is '${val}'")
   set_property(TARGET CustomTarget PROPERTY ${PROP})
 endmacro()
+
+macro(test_directory_property PROP)
+  set_property(DIRECTORY PROPERTY ${PROP} x)
+  set_property(DIRECTORY PROPERTY ${PROP})
+  set_property(DIRECTORY APPEND PROPERTY ${PROP})
+  set_property(DIRECTORY PROPERTY ${PROP} a)
+  set_property(DIRECTORY APPEND PROPERTY ${PROP} "")
+  set_property(DIRECTORY APPEND PROPERTY ${PROP} b c)
+  set_property(DIRECTORY APPEND PROPERTY ${PROP})
+  set_property(DIRECTORY APPEND PROPERTY ${PROP} "d;;e")
+  get_property(val DIRECTORY PROPERTY ${PROP})
+  message(STATUS "Directory ${PROP} is '${val}'")
+  set_property(DIRECTORY PROPERTY ${PROP})
+endmacro()
diff --git a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt
index 955bdf2..c957dd5 100644
--- a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt
+++ b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES-stdout.txt
@@ -1 +1,2 @@
 -- Target INCLUDE_DIRECTORIES is 'a;b;c;d;;e'
+-- Directory INCLUDE_DIRECTORIES is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake
index 8f44aee..c9a9151 100644
--- a/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake
+++ b/Tests/RunCMake/set_property/INCLUDE_DIRECTORIES.cmake
@@ -1,2 +1,3 @@
 include(Common.cmake)
 test_target_property(INCLUDE_DIRECTORIES)
+test_directory_property(INCLUDE_DIRECTORIES)
diff --git a/Tests/RunCMake/set_property/USER_PROP-stdout.txt b/Tests/RunCMake/set_property/USER_PROP-stdout.txt
index eaf6e37..107cc87 100644
--- a/Tests/RunCMake/set_property/USER_PROP-stdout.txt
+++ b/Tests/RunCMake/set_property/USER_PROP-stdout.txt
@@ -1 +1,2 @@
 -- Target USER_PROP is 'a;b;c;d;;e'
+-- Directory USER_PROP is 'a;b;c;d;;e'
diff --git a/Tests/RunCMake/set_property/USER_PROP.cmake b/Tests/RunCMake/set_property/USER_PROP.cmake
index e1f88e1..aa0aa83 100644
--- a/Tests/RunCMake/set_property/USER_PROP.cmake
+++ b/Tests/RunCMake/set_property/USER_PROP.cmake
@@ -1,2 +1,3 @@
 include(Common.cmake)
 test_target_property(USER_PROP)
+test_directory_property(USER_PROP)
-- 
cgit v0.12