summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2015-03-12 16:45:20 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2019-08-27 10:50:08 (GMT)
commit375d01c6808713a0cfeef9ea092c8236ba063525 (patch)
tree8dfb0f8234904f5ad5c44a6486c5236326f2433e
parent9b6797e71d28d4ee201cb0f8ed5efa39784a2af3 (diff)
downloadCMake-375d01c6808713a0cfeef9ea092c8236ba063525.zip
CMake-375d01c6808713a0cfeef9ea092c8236ba063525.tar.gz
CMake-375d01c6808713a0cfeef9ea092c8236ba063525.tar.bz2
PCH: add example/test
-rw-r--r--Tests/PrecompileHeaders/CMakeLists.txt17
-rw-r--r--Tests/PrecompileHeaders/foo.c6
-rw-r--r--Tests/PrecompileHeaders/foobar.c7
-rw-r--r--Tests/PrecompileHeaders/include/bar.h9
-rw-r--r--Tests/PrecompileHeaders/include/foo.h6
5 files changed, 45 insertions, 0 deletions
diff --git a/Tests/PrecompileHeaders/CMakeLists.txt b/Tests/PrecompileHeaders/CMakeLists.txt
new file mode 100644
index 0000000..90e1915
--- /dev/null
+++ b/Tests/PrecompileHeaders/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.15)
+project(PrecompileHeaders C)
+
+add_library(foo foo.c)
+target_include_directories(foo PUBLIC include)
+target_precompile_headers(foo PUBLIC
+ foo.h
+ <stdio.h>
+ \"string.h\"
+)
+
+add_library(bar INTERFACE)
+target_include_directories(bar INTERFACE include)
+target_precompile_headers(bar INTERFACE bar.h)
+
+add_executable(foobar foobar.c)
+target_link_libraries(foobar foo bar)
diff --git a/Tests/PrecompileHeaders/foo.c b/Tests/PrecompileHeaders/foo.c
new file mode 100644
index 0000000..974a248
--- /dev/null
+++ b/Tests/PrecompileHeaders/foo.c
@@ -0,0 +1,6 @@
+#include "foo.h"
+
+int foo()
+{
+ return 0;
+}
diff --git a/Tests/PrecompileHeaders/foobar.c b/Tests/PrecompileHeaders/foobar.c
new file mode 100644
index 0000000..6dbf8ce
--- /dev/null
+++ b/Tests/PrecompileHeaders/foobar.c
@@ -0,0 +1,7 @@
+#include "bar.h"
+#include "foo.h"
+
+int main()
+{
+ return foo() + bar();
+}
diff --git a/Tests/PrecompileHeaders/include/bar.h b/Tests/PrecompileHeaders/include/bar.h
new file mode 100644
index 0000000..5feb983
--- /dev/null
+++ b/Tests/PrecompileHeaders/include/bar.h
@@ -0,0 +1,9 @@
+#ifndef bar_h
+#define bar_h
+
+static int bar()
+{
+ return 0;
+}
+
+#endif
diff --git a/Tests/PrecompileHeaders/include/foo.h b/Tests/PrecompileHeaders/include/foo.h
new file mode 100644
index 0000000..4a49474
--- /dev/null
+++ b/Tests/PrecompileHeaders/include/foo.h
@@ -0,0 +1,6 @@
+#ifndef foo_h
+#define foo_h
+
+extern int foo();
+
+#endif