diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2022-04-11 17:50:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-04-11 18:16:33 (GMT) |
commit | 476c6a89109d9737715c74bf3458628b665c4c8d (patch) | |
tree | a85d85b7a1ace54eca746470bb0314b835aaf9ad /Source | |
parent | fcf1fcfd0c7eb360c26ff389649ee00380d30d15 (diff) | |
download | CMake-476c6a89109d9737715c74bf3458628b665c4c8d.zip CMake-476c6a89109d9737715c74bf3458628b665c4c8d.tar.gz CMake-476c6a89109d9737715c74bf3458628b665c4c8d.tar.bz2 |
PCH: Fix Xcode non-pch language exclusion
Fix a regression caused by commit bbcdac4e5d (PCH: Fix all-language
precompile header support in Xcode, 2021-08-07, v3.22.0-rc1~140^2).
Fixes: #23138
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index fc5e6e5..feea49f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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; |