From 375d01c6808713a0cfeef9ea092c8236ba063525 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 12 Mar 2015 17:45:20 +0100 Subject: PCH: add example/test --- Tests/PrecompileHeaders/CMakeLists.txt | 17 +++++++++++++++++ Tests/PrecompileHeaders/foo.c | 6 ++++++ Tests/PrecompileHeaders/foobar.c | 7 +++++++ Tests/PrecompileHeaders/include/bar.h | 9 +++++++++ Tests/PrecompileHeaders/include/foo.h | 6 ++++++ 5 files changed, 45 insertions(+) create mode 100644 Tests/PrecompileHeaders/CMakeLists.txt create mode 100644 Tests/PrecompileHeaders/foo.c create mode 100644 Tests/PrecompileHeaders/foobar.c create mode 100644 Tests/PrecompileHeaders/include/bar.h create mode 100644 Tests/PrecompileHeaders/include/foo.h 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 + + \"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 -- cgit v0.12