summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/PrecompileHeaders
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2019-10-03 19:53:42 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2019-10-03 20:58:55 (GMT)
commit1144a4fa47d467ac3bd2f70ed2dffd04734d53a7 (patch)
tree06ccd93a750afc2e28de0d888653f6db93c0e74e /Tests/RunCMake/PrecompileHeaders
parent3247506662684003e19d9552ab5ce70643808f4d (diff)
downloadCMake-1144a4fa47d467ac3bd2f70ed2dffd04734d53a7.zip
CMake-1144a4fa47d467ac3bd2f70ed2dffd04734d53a7.tar.gz
CMake-1144a4fa47d467ac3bd2f70ed2dffd04734d53a7.tar.bz2
PCH: Add multi-language PCH generation support
If the target has C files, it will get a C PCH file. The same for C++ files. The linker language is no longer used to determine which language to use for PCH. Fixes: #19790
Diffstat (limited to 'Tests/RunCMake/PrecompileHeaders')
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake17
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake9
-rw-r--r--Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake1
3 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
new file mode 100644
index 0000000..5a304f5
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
@@ -0,0 +1,17 @@
+if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(foobar_pch_h_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h")
+ set(foobar_pch_hxx_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.hxx")
+else()
+ set(foobar_pch_h_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h")
+ set(foobar_pch_hxx_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.hxx")
+endif()
+
+if (NOT EXISTS ${foobar_pch_h_header})
+ set(RunCMake_TEST_FAILED "Generated foobar C pch header ${foobar_pch_h_header} does not exist")
+ return()
+endif()
+
+if (NOT EXISTS ${foobar_pch_hxx_header})
+ set(RunCMake_TEST_FAILED "Generated foobar C++ pch header ${foobar_pch_hxx_header} does not exist")
+ return()
+endif()
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
new file mode 100644
index 0000000..4face95
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.15)
+project(PchMultilanguage C CXX)
+
+add_executable(foobar
+ foo.c
+ main.cpp
+)
+target_include_directories(foobar PUBLIC include)
+target_precompile_headers(foobar PRIVATE "<stddef.h>")
diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
index bd3b1b8..ec13663 100644
--- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
@@ -18,3 +18,4 @@ run_cmake(PchPrologueEpilogue)
run_test(SkipPrecompileHeaders)
run_test(PchReuseFrom)
run_test(PchReuseFromSubdir)
+run_cmake(PchMultilanguage)