瀏覽代碼

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.
Alex Neundorf 2 年之前
父節點
當前提交
87788353cc

+ 2 - 0
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)

+ 4 - 0
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 )

+ 11 - 0
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;
+}

+ 4 - 0
Tests/SourceGroups/sub2/qux.c

@@ -0,0 +1,4 @@
+int qux(void)
+{
+  return 1234;
+}

+ 4 - 0
Tests/SourceGroups/sub2/subsub/qax.c

@@ -0,0 +1,4 @@
+int qax(void)
+{
+  return 123;
+}