summaryrefslogtreecommitdiffstats
path: root/Source/cmSetPropertyCommand.cxx
diff options
context:
space:
mode:
authorAsit Dhal <dhal.asitk@gmail.com>2019-09-15 17:11:02 (GMT)
committerBrad King <brad.king@kitware.com>2019-09-18 18:18:46 (GMT)
commit9dba84cfa5e85e51ee6d6799f03a26656063ef8b (patch)
tree22fb29536def399e2ab763ac202a52467d45d7e2 /Source/cmSetPropertyCommand.cxx
parent1423507a71199fd76b457ad9b215a6caca70ee58 (diff)
downloadCMake-9dba84cfa5e85e51ee6d6799f03a26656063ef8b.zip
CMake-9dba84cfa5e85e51ee6d6799f03a26656063ef8b.tar.gz
CMake-9dba84cfa5e85e51ee6d6799f03a26656063ef8b.tar.bz2
Refactor: Use cmStrCat to construct error strings
Replace string construction using std::stringstream with cmStrCat and cmWrap.
Diffstat (limited to 'Source/cmSetPropertyCommand.cxx')
-rw-r--r--Source/cmSetPropertyCommand.cxx56
1 files changed, 22 insertions, 34 deletions
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 387c3fc..112d832 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -100,11 +100,10 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args,
} else if (scopeName == "INSTALL") {
scope = cmProperty::INSTALL;
} else {
- std::ostringstream e;
- e << "given invalid scope " << scopeName << ". "
- << "Valid scopes are GLOBAL, DIRECTORY, "
- "TARGET, SOURCE, TEST, CACHE, INSTALL.";
- status.SetError(e.str());
+ status.SetError(cmStrCat("given invalid scope ", scopeName,
+ ". "
+ "Valid scopes are GLOBAL, DIRECTORY, "
+ "TARGET, SOURCE, TEST, CACHE, INSTALL."));
return false;
}
@@ -149,9 +148,7 @@ bool cmSetPropertyCommand(std::vector<std::string> const& args,
propertyValue += arg;
remove = false;
} else {
- std::ostringstream e;
- e << "given invalid argument \"" << arg << "\".";
- status.SetError(e.str());
+ status.SetError(cmStrCat("given invalid argument \"", arg, "\"."));
return false;
}
}
@@ -293,10 +290,8 @@ bool HandleTargetMode(cmExecutionStatus& status,
return false;
}
} else {
- std::ostringstream e;
- e << "could not find TARGET " << name
- << ". Perhaps it has not yet been created.";
- status.SetError(e.str());
+ status.SetError(cmStrCat("could not find TARGET ", name,
+ ". Perhaps it has not yet been created."));
return false;
}
}
@@ -340,9 +335,8 @@ bool HandleSourceMode(cmExecutionStatus& status,
return false;
}
} else {
- std::ostringstream e;
- e << "given SOURCE name that could not be found or created: " << name;
- status.SetError(e.str());
+ status.SetError(cmStrCat(
+ "given SOURCE name that could not be found or created: ", name));
return false;
}
}
@@ -428,26 +422,23 @@ bool HandleCacheMode(cmExecutionStatus& status,
{
if (propertyName == "ADVANCED") {
if (!remove && !cmIsOn(propertyValue) && !cmIsOff(propertyValue)) {
- std::ostringstream e;
- e << "given non-boolean value \"" << propertyValue
- << R"(" for CACHE property "ADVANCED". )";
- status.SetError(e.str());
+ status.SetError(cmStrCat("given non-boolean value \"", propertyValue,
+ R"(" for CACHE property "ADVANCED". )"));
return false;
}
} else if (propertyName == "TYPE") {
if (!cmState::IsCacheEntryType(propertyValue)) {
- std::ostringstream e;
- e << "given invalid CACHE entry TYPE \"" << propertyValue << "\"";
- status.SetError(e.str());
+ status.SetError(
+ cmStrCat("given invalid CACHE entry TYPE \"", propertyValue, "\""));
return false;
}
} else if (propertyName != "HELPSTRING" && propertyName != "STRINGS" &&
propertyName != "VALUE") {
- std::ostringstream e;
- e << "given invalid CACHE property " << propertyName << ". "
- << "Settable CACHE properties are: "
- << "ADVANCED, HELPSTRING, STRINGS, TYPE, and VALUE.";
- status.SetError(e.str());
+ status.SetError(
+ cmStrCat("given invalid CACHE property ", propertyName,
+ ". "
+ "Settable CACHE properties are: "
+ "ADVANCED, HELPSTRING, STRINGS, TYPE, and VALUE."));
return false;
}
@@ -462,10 +453,8 @@ bool HandleCacheMode(cmExecutionStatus& status,
return false;
}
} else {
- std::ostringstream e;
- e << "could not find CACHE variable " << name
- << ". Perhaps it has not yet been created.";
- status.SetError(e.str());
+ status.SetError(cmStrCat("could not find CACHE variable ", name,
+ ". Perhaps it has not yet been created."));
return false;
}
}
@@ -511,9 +500,8 @@ bool HandleInstallMode(cmExecutionStatus& status,
return false;
}
} else {
- std::ostringstream e;
- e << "given INSTALL name that could not be found or created: " << name;
- status.SetError(e.str());
+ status.SetError(cmStrCat(
+ "given INSTALL name that could not be found or created: ", name));
return false;
}
}