summaryrefslogtreecommitdiffstats
path: root/Tests/SourceGroups
diff options
context:
space:
mode:
authorMateusz Janek <stryku2393@gmail.com>2016-12-21 14:27:49 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-16 15:52:48 (GMT)
commitb42330be21c0d3046aa0e6fdf046a492bddef520 (patch)
treeefd6fbbda9401a36000f2c3b265b9d43310348e6 /Tests/SourceGroups
parent6154a2cddcdb297b1aef20f501fec9af7d7b5262 (diff)
downloadCMake-b42330be21c0d3046aa0e6fdf046a492bddef520.zip
CMake-b42330be21c0d3046aa0e6fdf046a492bddef520.tar.gz
CMake-b42330be21c0d3046aa0e6fdf046a492bddef520.tar.bz2
source_group: Add options create groups matching directory tree
Add `TREE` and `PREFIX` arguments to enable this behavior.
Diffstat (limited to 'Tests/SourceGroups')
-rw-r--r--Tests/SourceGroups/CMakeLists.txt13
-rw-r--r--Tests/SourceGroups/main.c7
-rw-r--r--Tests/SourceGroups/sub1/tree_bar.c4
-rw-r--r--Tests/SourceGroups/sub1/tree_baz.c4
-rw-r--r--Tests/SourceGroups/sub1/tree_subdir/tree_foobar.c4
-rw-r--r--Tests/SourceGroups/tree_foo.c4
6 files changed, 35 insertions, 1 deletions
diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt
index 6573c82..9289e84 100644
--- a/Tests/SourceGroups/CMakeLists.txt
+++ b/Tests/SourceGroups/CMakeLists.txt
@@ -30,6 +30,17 @@ source_group(Base\\Sub1\\Base FILES bar.c)
# a group without files, is currently not created
source_group(EmptyGroup)
+set(root ${CMAKE_CURRENT_SOURCE_DIR})
-add_executable(SourceGroups main.c bar.c foo.c sub1/foo.c sub1/foobar.c baz.c README.txt)
+set(tree_files_without_prefix ${root}/sub1/tree_bar.c
+ ${root}/sub1/tree_baz.c
+ ${root}/sub1/tree_subdir/tree_foobar.c)
+set(tree_files_with_prefix ${root}/tree_foo.c)
+
+source_group(TREE ${root} FILES ${tree_files_without_prefix})
+
+source_group(TREE ${root} PREFIX tree_root/subgroup FILES ${tree_files_with_prefix})
+
+add_executable(SourceGroups main.c bar.c foo.c sub1/foo.c sub1/foobar.c baz.c
+ ${tree_files_with_prefix} ${tree_files_without_prefix} README.txt)
diff --git a/Tests/SourceGroups/main.c b/Tests/SourceGroups/main.c
index f259f98..b88f2f8 100644
--- a/Tests/SourceGroups/main.c
+++ b/Tests/SourceGroups/main.c
@@ -5,10 +5,17 @@ extern int bar(void);
extern int foobar(void);
extern int barbar(void);
extern int baz(void);
+extern int tree_foo(void);
+extern int tree_bar(void);
+extern int tree_foobar(void);
+extern int tree_baz(void);
int main()
{
printf("foo: %d bar: %d foobar: %d barbar: %d baz: %d\n", foo(), bar(),
foobar(), barbar(), baz());
+
+ printf("tree_foo: %d tree_bar: %d tree_foobar: %d tree_baz: %d\n",
+ tree_foo(), tree_bar(), tree_foobar(), tree_baz());
return 0;
}
diff --git a/Tests/SourceGroups/sub1/tree_bar.c b/Tests/SourceGroups/sub1/tree_bar.c
new file mode 100644
index 0000000..6b79239
--- /dev/null
+++ b/Tests/SourceGroups/sub1/tree_bar.c
@@ -0,0 +1,4 @@
+int tree_bar(void)
+{
+ return 8;
+}
diff --git a/Tests/SourceGroups/sub1/tree_baz.c b/Tests/SourceGroups/sub1/tree_baz.c
new file mode 100644
index 0000000..27ff5ab
--- /dev/null
+++ b/Tests/SourceGroups/sub1/tree_baz.c
@@ -0,0 +1,4 @@
+int tree_baz(void)
+{
+ return 9;
+}
diff --git a/Tests/SourceGroups/sub1/tree_subdir/tree_foobar.c b/Tests/SourceGroups/sub1/tree_subdir/tree_foobar.c
new file mode 100644
index 0000000..e955e04
--- /dev/null
+++ b/Tests/SourceGroups/sub1/tree_subdir/tree_foobar.c
@@ -0,0 +1,4 @@
+int tree_foobar(void)
+{
+ return 7;
+}
diff --git a/Tests/SourceGroups/tree_foo.c b/Tests/SourceGroups/tree_foo.c
new file mode 100644
index 0000000..d392e41
--- /dev/null
+++ b/Tests/SourceGroups/tree_foo.c
@@ -0,0 +1,4 @@
+int tree_foo(void)
+{
+ return 6;
+}