diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2020-04-02 12:16:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-04-02 15:51:19 (GMT) |
commit | f593b354da2e9637e9b869688934f0ba2544ebed (patch) | |
tree | 605f4a05ad9773e658fd14974f7000f769a90014 /Source/cmFileAPICodemodel.cxx | |
parent | be154ea1e3efcd1a13952701337378a01ca0cd19 (diff) | |
download | CMake-f593b354da2e9637e9b869688934f0ba2544ebed.zip CMake-f593b354da2e9637e9b869688934f0ba2544ebed.tar.gz CMake-f593b354da2e9637e9b869688934f0ba2544ebed.tar.bz2 |
PCH: Add support for multi architecture iOS projects
Fixes: #20497
Diffstat (limited to 'Source/cmFileAPICodemodel.cxx')
-rw-r--r-- | Source/cmFileAPICodemodel.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 955195f..70f5847 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -872,14 +872,27 @@ CompileData Target::BuildCompileData(cmSourceFile* sf) } // Add precompile headers compile options. - const std::string pchSource = - this->GT->GetPchSource(this->Config, fd.Language); + std::vector<std::string> architectures; + this->GT->GetAppleArchs(this->Config, architectures); + if (architectures.empty()) { + architectures.emplace_back(); + } + + std::unordered_map<std::string, std::string> pchSources; + for (const std::string& arch : architectures) { + const std::string pchSource = + this->GT->GetPchSource(this->Config, fd.Language, arch); + if (!pchSource.empty()) { + pchSources.insert(std::make_pair(pchSource, arch)); + } + } - if (!pchSource.empty() && !sf->GetProperty("SKIP_PRECOMPILE_HEADERS")) { + if (!pchSources.empty() && !sf->GetProperty("SKIP_PRECOMPILE_HEADERS")) { std::string pchOptions; - if (sf->ResolveFullPath() == pchSource) { - pchOptions = - this->GT->GetPchCreateCompileOptions(this->Config, fd.Language); + auto pchIt = pchSources.find(sf->ResolveFullPath()); + if (pchIt != pchSources.end()) { + pchOptions = this->GT->GetPchCreateCompileOptions( + this->Config, fd.Language, pchIt->second); } else { pchOptions = this->GT->GetPchUseCompileOptions(this->Config, fd.Language); |