summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2023-06-30 20:21:43 (GMT)
committerBrad King <brad.king@kitware.com>2023-07-05 11:54:54 (GMT)
commit87788353cc1cae7ee3b6f47d5f0f7a46df11d75e (patch)
tree0d5c48a4069c20397a72c3a3ef5225a625fbfe17 /Tests
parentd85238a2f29c552041293f1f7e64e3de55e55907 (diff)
downloadCMake-87788353cc1cae7ee3b6f47d5f0f7a46df11d75e.zip
CMake-87788353cc1cae7ee3b6f47d5f0f7a46df11d75e.tar.gz
CMake-87788353cc1cae7ee3b6f47d5f0f7a46df11d75e.tar.bz2
source_group: Add test/example for TREE without FILES
This creates an additional target and for its three source files a directory tree is created.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/SourceGroups/CMakeLists.txt2
-rw-r--r--Tests/SourceGroups/sub2/CMakeLists.txt4
-rw-r--r--Tests/SourceGroups/sub2/main.c11
-rw-r--r--Tests/SourceGroups/sub2/qux.c4
-rw-r--r--Tests/SourceGroups/sub2/subsub/qax.c4
5 files changed, 25 insertions, 0 deletions
diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt
index d726395..550fe9e 100644
--- a/Tests/SourceGroups/CMakeLists.txt
+++ b/Tests/SourceGroups/CMakeLists.txt
@@ -63,3 +63,5 @@ 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}
${tree_files_with_empty_prefix} README.txt
nested.c)
+
+add_subdirectory(sub2)
diff --git a/Tests/SourceGroups/sub2/CMakeLists.txt b/Tests/SourceGroups/sub2/CMakeLists.txt
new file mode 100644
index 0000000..e457bc4
--- /dev/null
+++ b/Tests/SourceGroups/sub2/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_executable(SourceGroups2 main.c
+ qux.c subsub/qax.c)
+
+source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" ) #PREFIX TheSubDir2 )
diff --git a/Tests/SourceGroups/sub2/main.c b/Tests/SourceGroups/sub2/main.c
new file mode 100644
index 0000000..4cd8ae0
--- /dev/null
+++ b/Tests/SourceGroups/sub2/main.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+extern int qax(void);
+extern int qux(void);
+
+int main()
+{
+ printf("qux: %d qax: %d\n", qux(), qax());
+
+ return 0;
+}
diff --git a/Tests/SourceGroups/sub2/qux.c b/Tests/SourceGroups/sub2/qux.c
new file mode 100644
index 0000000..1a8b6f9
--- /dev/null
+++ b/Tests/SourceGroups/sub2/qux.c
@@ -0,0 +1,4 @@
+int qux(void)
+{
+ return 1234;
+}
diff --git a/Tests/SourceGroups/sub2/subsub/qax.c b/Tests/SourceGroups/sub2/subsub/qax.c
new file mode 100644
index 0000000..c1b1042
--- /dev/null
+++ b/Tests/SourceGroups/sub2/subsub/qax.c
@@ -0,0 +1,4 @@
+int qax(void)
+{
+ return 123;
+}