mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 07:11:05 -06:00
cmCreateTestSourceList: simplify string operations
Use `cmStrCat` where possible and use character literals instead of length-1 string literals.
This commit is contained in:
@@ -81,8 +81,8 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
|
||||
}
|
||||
std::string func_name;
|
||||
if (!cmSystemTools::GetFilenamePath(*i).empty()) {
|
||||
func_name = cmSystemTools::GetFilenamePath(*i) + "/" +
|
||||
cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
||||
func_name = cmStrCat(cmSystemTools::GetFilenamePath(*i), '/',
|
||||
cmSystemTools::GetFilenameWithoutLastExtension(*i));
|
||||
} else {
|
||||
func_name = cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
||||
}
|
||||
@@ -93,9 +93,7 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
|
||||
tests_func_name.end();
|
||||
tests_func_name.push_back(func_name);
|
||||
if (!already_declared) {
|
||||
forwardDeclareCode += "int ";
|
||||
forwardDeclareCode += func_name;
|
||||
forwardDeclareCode += "(int, char*[]);\n";
|
||||
forwardDeclareCode += cmStrCat("int ", func_name, "(int, char*[]);\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,8 +103,8 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
|
||||
++i, ++j) {
|
||||
std::string func_name;
|
||||
if (!cmSystemTools::GetFilenamePath(*i).empty()) {
|
||||
func_name = cmSystemTools::GetFilenamePath(*i) + "/" +
|
||||
cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
||||
func_name = cmStrCat(cmSystemTools::GetFilenamePath(*i), '/',
|
||||
cmSystemTools::GetFilenameWithoutLastExtension(*i));
|
||||
} else {
|
||||
func_name = cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
||||
}
|
||||
@@ -142,7 +140,7 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
|
||||
for (i = testsBegin; i != tests.end(); ++i) {
|
||||
cmSourceFile* sf = mf.GetOrCreateSource(*i);
|
||||
sf->SetProperty("ABSTRACT", "0");
|
||||
sourceListValue += ";";
|
||||
sourceListValue += ';';
|
||||
sourceListValue += *i;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user