summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-09-14 13:47:45 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-09-14 13:48:00 (GMT)
commit69c0a5daf98958ba6ad4311781ec72fe8b9bfb0a (patch)
treedf52b3e1a2631b70f0d602a4348414d3a607e9bf /Source/cmLocalGenerator.cxx
parent8f67d42671942aebfe345a574c563f59efe931d0 (diff)
parentbbcdac4e5d53de12013c6af6395b28e4816f7823 (diff)
downloadCMake-69c0a5daf98958ba6ad4311781ec72fe8b9bfb0a.zip
CMake-69c0a5daf98958ba6ad4311781ec72fe8b9bfb0a.tar.gz
CMake-69c0a5daf98958ba6ad4311781ec72fe8b9bfb0a.tar.bz2
Merge topic 'pch-xcode-multiple-languages'
bbcdac4e5d PCH: Fix all-language precompile header support in Xcode Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !6435
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5fe5c75..8be015e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2510,6 +2510,16 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC",
"OBJCXX" } };
+ bool haveAnyPch = false;
+ if (this->GetGlobalGenerator()->IsXcode()) {
+ for (const std::string& lang : langs) {
+ const std::string pchHeader = target->GetPchHeader(config, lang, "");
+ if (!pchHeader.empty()) {
+ haveAnyPch = true;
+ }
+ }
+ }
+
for (const std::string& lang : langs) {
auto langSources = std::count_if(
sources.begin(), sources.end(), [lang](cmSourceFile* sf) {
@@ -2550,6 +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) {
+ for (auto* sf : sources) {
+ sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON");
+ }
+ }
continue;
}