mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-01 20:00:51 -05: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;
|
std::string func_name;
|
||||||
if (!cmSystemTools::GetFilenamePath(*i).empty()) {
|
if (!cmSystemTools::GetFilenamePath(*i).empty()) {
|
||||||
func_name = cmSystemTools::GetFilenamePath(*i) + "/" +
|
func_name = cmStrCat(cmSystemTools::GetFilenamePath(*i), '/',
|
||||||
cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
cmSystemTools::GetFilenameWithoutLastExtension(*i));
|
||||||
} else {
|
} else {
|
||||||
func_name = cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
func_name = cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
||||||
}
|
}
|
||||||
@@ -93,9 +93,7 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
|
|||||||
tests_func_name.end();
|
tests_func_name.end();
|
||||||
tests_func_name.push_back(func_name);
|
tests_func_name.push_back(func_name);
|
||||||
if (!already_declared) {
|
if (!already_declared) {
|
||||||
forwardDeclareCode += "int ";
|
forwardDeclareCode += cmStrCat("int ", func_name, "(int, char*[]);\n");
|
||||||
forwardDeclareCode += func_name;
|
|
||||||
forwardDeclareCode += "(int, char*[]);\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,8 +103,8 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
|
|||||||
++i, ++j) {
|
++i, ++j) {
|
||||||
std::string func_name;
|
std::string func_name;
|
||||||
if (!cmSystemTools::GetFilenamePath(*i).empty()) {
|
if (!cmSystemTools::GetFilenamePath(*i).empty()) {
|
||||||
func_name = cmSystemTools::GetFilenamePath(*i) + "/" +
|
func_name = cmStrCat(cmSystemTools::GetFilenamePath(*i), '/',
|
||||||
cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
cmSystemTools::GetFilenameWithoutLastExtension(*i));
|
||||||
} else {
|
} else {
|
||||||
func_name = cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
func_name = cmSystemTools::GetFilenameWithoutLastExtension(*i);
|
||||||
}
|
}
|
||||||
@@ -142,7 +140,7 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
|
|||||||
for (i = testsBegin; i != tests.end(); ++i) {
|
for (i = testsBegin; i != tests.end(); ++i) {
|
||||||
cmSourceFile* sf = mf.GetOrCreateSource(*i);
|
cmSourceFile* sf = mf.GetOrCreateSource(*i);
|
||||||
sf->SetProperty("ABSTRACT", "0");
|
sf->SetProperty("ABSTRACT", "0");
|
||||||
sourceListValue += ";";
|
sourceListValue += ';';
|
||||||
sourceListValue += *i;
|
sourceListValue += *i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user