summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-01 12:28:51 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-05-01 12:30:20 (GMT)
commit255c95163a3fed079167400aa5e978e403ca72fb (patch)
tree58fc94cfc81c5b4bb89e3016ef2fa235ac60bf9f /Source/cmGeneratorTarget.cxx
parent8228246d9b89b97456f15188536afe822593bc63 (diff)
parent53675adbcf2f485d68c45e53d28baf6db220264c (diff)
downloadCMake-255c95163a3fed079167400aa5e978e403ca72fb.zip
CMake-255c95163a3fed079167400aa5e978e403ca72fb.tar.gz
CMake-255c95163a3fed079167400aa5e978e403ca72fb.tar.bz2
Merge topic 'stdstring-getsafeprop'
53675adbcf GetSafeProperty: return std::string const& Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4683
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index ac08cf7..62427f6 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -387,14 +387,16 @@ cmProp cmGeneratorTarget::GetProperty(const std::string& prop) const
return this->Target->GetProperty(prop);
}
-const char* cmGeneratorTarget::GetSafeProperty(const std::string& prop) const
+std::string const& cmGeneratorTarget::GetSafeProperty(
+ std::string const& prop) const
{
cmProp ret = this->GetProperty(prop);
- if (!ret) {
- return "";
+ if (ret) {
+ return *ret;
}
- return ret->c_str();
+ static std::string const s_empty;
+ return s_empty;
}
const char* cmGeneratorTarget::GetOutputTargetType(
@@ -3987,7 +3989,8 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
const std::string useOptVar =
cmStrCat(language, "_COMPILE_OPTIONS_USE_PCH");
- const std::string useOptionListProperty = this->GetSafeProperty(useOptVar);
+ std::string const& useOptionListProperty =
+ this->GetSafeProperty(useOptVar);
useOptionList = cmStrCat(
useOptionList, ";",