summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake')
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake27
1 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
new file mode 100644
index 0000000..03a97ed
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.15)
+project(PchReuseFrom C)
+
+if(CMAKE_C_COMPILE_OPTIONS_USE_PCH)
+ add_definitions(-DHAVE_PCH_SUPPORT)
+endif()
+
+add_library(empty empty.c)
+target_precompile_headers(empty PRIVATE
+ <stdio.h>
+ <string.h>
+)
+target_include_directories(empty PUBLIC include)
+
+add_library(foo foo.c)
+target_include_directories(foo PUBLIC include)
+target_precompile_headers(foo REUSE_FROM empty)
+
+# should not cause problems if configured multiple times
+target_precompile_headers(foo REUSE_FROM empty)
+
+add_executable(foobar foobar.c)
+target_link_libraries(foobar foo )
+set_target_properties(foobar PROPERTIES PRECOMPILE_HEADERS_REUSE_FROM foo)
+
+enable_testing()
+add_test(NAME foobar COMMAND foobar)