Commit 1144a4fa authored by Cristian Adam's avatar Cristian Adam

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
parent 32475066
This diff is collapsed.
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()
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>")
......@@ -18,3 +18,4 @@ run_cmake(PchPrologueEpilogue)
run_test(SkipPrecompileHeaders)
run_test(PchReuseFrom)
run_test(PchReuseFromSubdir)
run_cmake(PchMultilanguage)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment