mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
Merge topic 'pch-reuse-no-prop'
bb4c2781ce PCH: Do not issue an error on duplicate target_precompile_headers call
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4046
This commit is contained in:
@@ -3360,19 +3360,20 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
|
||||
if (this->GetPropertyAsBool("DISABLE_PRECOMPILE_HEADERS")) {
|
||||
return std::string();
|
||||
}
|
||||
const cmGeneratorTarget* generatorTarget = this;
|
||||
const char* pchReuseFrom =
|
||||
generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
|
||||
|
||||
const auto inserted =
|
||||
this->PchHeaders.insert(std::make_pair(language + config, ""));
|
||||
if (inserted.second) {
|
||||
const std::vector<BT<std::string>> headers =
|
||||
this->GetPrecompileHeaders(config, language);
|
||||
if (headers.empty()) {
|
||||
if (headers.empty() && !pchReuseFrom) {
|
||||
return std::string();
|
||||
}
|
||||
std::string& filename = inserted.first->second;
|
||||
|
||||
const cmGeneratorTarget* generatorTarget = this;
|
||||
const char* pchReuseFrom =
|
||||
generatorTarget->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
|
||||
if (pchReuseFrom) {
|
||||
generatorTarget =
|
||||
this->GetGlobalGenerator()->FindGeneratorTarget(pchReuseFrom);
|
||||
|
||||
+2
-5
@@ -1288,11 +1288,8 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
|
||||
reusedTarget->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
|
||||
cmStrCat(reusedFrom, ".dir/").c_str());
|
||||
|
||||
for (auto p : { "COMPILE_PDB_NAME", "PRECOMPILE_HEADERS",
|
||||
"INTERFACE_PRECOMPILE_HEADERS" }) {
|
||||
this->SetProperty(p, reusedTarget->GetProperty(p));
|
||||
}
|
||||
|
||||
this->SetProperty("COMPILE_PDB_NAME",
|
||||
reusedTarget->GetProperty("COMPILE_PDB_NAME"));
|
||||
this->AddUtility(reusedFrom, impl->Makefile);
|
||||
} else {
|
||||
impl->Properties.SetProperty(prop, value);
|
||||
|
||||
Reference in New Issue
Block a user