diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-10-12 22:18:22 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-10-15 09:14:21 (GMT) |
commit | aaa5dbbf64392dad518668ac1d046d624dac41f3 (patch) | |
tree | a6f9d8df8b5c39d0d8da32415c8c73b803221661 /Source | |
parent | 0d818632978a450f1afaf687c867e62e885457f7 (diff) | |
download | CMake-aaa5dbbf64392dad518668ac1d046d624dac41f3.zip CMake-aaa5dbbf64392dad518668ac1d046d624dac41f3.tar.gz CMake-aaa5dbbf64392dad518668ac1d046d624dac41f3.tar.bz2 |
cmTarget: Use static storage for computed properties
Avoid having to populate a mutable container to return a value.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmTarget.cxx | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 651bcc8..ca2c37d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1100,8 +1100,9 @@ const char* cmTarget::GetProperty(const std::string& prop, // available configuration. // if (this->IsImported()) { - this->Properties.SetProperty( - propLOCATION, this->ImportedGetFullPath("", false).c_str()); + static std::string loc; + loc = this->ImportedGetFullPath("", false); + return loc.c_str(); } else { // For a non-imported target this is deprecated because it // cannot take into account the per-configuration name of the @@ -1112,7 +1113,9 @@ const char* cmTarget::GetProperty(const std::string& prop, gg->CreateGenerationObjects(); } cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName()); - this->Properties.SetProperty(propLOCATION, gt->GetLocationForBuild()); + static std::string loc; + loc = gt->GetLocationForBuild(); + return loc.c_str(); } } @@ -1125,16 +1128,18 @@ const char* cmTarget::GetProperty(const std::string& prop, const char* configName = prop.c_str() + 9; if (this->IsImported()) { - this->Properties.SetProperty( - prop, this->ImportedGetFullPath(configName, false).c_str()); + static std::string loc; + loc = this->ImportedGetFullPath(configName, false); + return loc.c_str(); } else { cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); if (!gg->GetConfigureDoneCMP0026()) { gg->CreateGenerationObjects(); } cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName()); - this->Properties.SetProperty( - prop, gt->GetFullPath(configName, false).c_str()); + static std::string loc; + loc = gt->GetFullPath(configName, false); + return loc.c_str(); } } // Support "<CONFIG>_LOCATION". @@ -1146,16 +1151,18 @@ const char* cmTarget::GetProperty(const std::string& prop, return CM_NULLPTR; } if (this->IsImported()) { - this->Properties.SetProperty( - prop, this->ImportedGetFullPath(configName, false).c_str()); + static std::string loc; + loc = this->ImportedGetFullPath(configName, false); + return loc.c_str(); } else { cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator(); if (!gg->GetConfigureDoneCMP0026()) { gg->CreateGenerationObjects(); } cmGeneratorTarget* gt = gg->FindGeneratorTarget(this->GetName()); - this->Properties.SetProperty( - prop, gt->GetFullPath(configName, false).c_str()); + static std::string loc; + loc = gt->GetFullPath(configName, false); + return loc.c_str(); } } } @@ -1330,7 +1337,9 @@ const char* cmTarget::GetProperty(const std::string& prop, } } } - this->Properties.SetProperty("SOURCES", ss.str().c_str()); + static std::string srcs; + srcs = ss.str(); + return srcs.c_str(); } } |