diff options
-rw-r--r-- | Tests/PrecompileHeaders/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/PrecompileHeaders/foo.c | 6 | ||||
-rw-r--r-- | Tests/PrecompileHeaders/foobar.c | 7 | ||||
-rw-r--r-- | Tests/PrecompileHeaders/include/bar.h | 9 | ||||
-rw-r--r-- | Tests/PrecompileHeaders/include/foo.h | 6 |
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 |