mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-24 17:18:37 -05:00
@@ -2510,12 +2510,12 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
||||
static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC",
|
||||
"OBJCXX" } };
|
||||
|
||||
bool haveAnyPch = false;
|
||||
std::set<std::string> pchLangSet;
|
||||
if (this->GetGlobalGenerator()->IsXcode()) {
|
||||
for (const std::string& lang : langs) {
|
||||
const std::string pchHeader = target->GetPchHeader(config, lang, "");
|
||||
if (!pchHeader.empty()) {
|
||||
haveAnyPch = true;
|
||||
pchLangSet.emplace(lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2560,9 +2560,11 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
||||
const std::string pchHeader = target->GetPchHeader(config, lang, arch);
|
||||
|
||||
if (pchSource.empty() || pchHeader.empty()) {
|
||||
if (this->GetGlobalGenerator()->IsXcode() && haveAnyPch) {
|
||||
if (this->GetGlobalGenerator()->IsXcode() && !pchLangSet.empty()) {
|
||||
for (auto* sf : sources) {
|
||||
sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON");
|
||||
if (pchLangSet.find(sf->GetLanguage()) == pchLangSet.end()) {
|
||||
sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON");
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(PchIncludedAllLanguages C CXX)
|
||||
|
||||
if(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH)
|
||||
add_definitions(-DHAVE_PCH_SUPPORT)
|
||||
endif()
|
||||
|
||||
add_executable(main
|
||||
main.cpp
|
||||
empty.c
|
||||
pch-included.cpp
|
||||
)
|
||||
|
||||
target_precompile_headers(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/pch.h>)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME main COMMAND main)
|
||||
@@ -29,4 +29,5 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
|
||||
endif()
|
||||
run_test(PchReuseFromObjLib)
|
||||
run_test(PchIncludedAllLanguages)
|
||||
run_test(PchIncludedOneLanguage)
|
||||
run_test(PchLibObjLibExe)
|
||||
|
||||
@@ -157,7 +157,7 @@ function(run_cmake test)
|
||||
"|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:"
|
||||
"|[^\n]*xcodebuild[^\n]*DVTPlugInManager"
|
||||
"|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type"
|
||||
"|[^\n]*objc[^\n]*: Class AMSupportURL[^\n]* One of the two will be used. Which one is undefined."
|
||||
"|[^\n]*objc[^\n]*: Class [^\n]* One of the two will be used. Which one is undefined."
|
||||
"|[^\n]*is a member of multiple groups"
|
||||
"|[^\n]*offset in archive not a multiple of 8"
|
||||
"|[^\n]*from Time Machine by path"
|
||||
|
||||
Reference in New Issue
Block a user