summaryrefslogtreecommitdiffstats
path: root/Source/cmStringCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r--Source/cmStringCommand.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 653b383..4000a7d 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -11,6 +11,7 @@
#include <memory>
#include <cm/iterator>
+#include <cm/string_view>
#include <cmext/string_view>
#include "cmsys/RegularExpression.hxx"
@@ -534,11 +535,14 @@ bool HandleAppendCommand(std::vector<std::string> const& args,
return true;
}
- const std::string& variable = args[1];
+ auto const& variableName = args[1];
+
+ cm::string_view oldView{ status.GetMakefile().GetSafeDefinition(
+ variableName) };
+
+ auto const newValue = cmJoin(cmMakeRange(args).advance(2), {}, oldView);
+ status.GetMakefile().AddDefinition(variableName, newValue);
- std::string value = status.GetMakefile().GetSafeDefinition(variable);
- value += cmJoin(cmMakeRange(args).advance(2), std::string());
- status.GetMakefile().AddDefinition(variable, value);
return true;
}