diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-12-09 20:06:36 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-12-11 17:15:28 (GMT) |
commit | 609af7734ff14a04721463eb969f8ebb1a8de49c (patch) | |
tree | aefb1b34c48ac481bc805e769236522a3495c963 /Source/cmCreateTestSourceList.cxx | |
parent | 2040b79a39a6d1ea3a60e9aba24907af54599134 (diff) | |
download | CMake-609af7734ff14a04721463eb969f8ebb1a8de49c.zip CMake-609af7734ff14a04721463eb969f8ebb1a8de49c.tar.gz CMake-609af7734ff14a04721463eb969f8ebb1a8de49c.tar.bz2 |
cmCreateTestSourceList: simplify string operations
Use `cmStrCat` where possible and use character literals instead of
length-1 string literals.
Diffstat (limited to 'Source/cmCreateTestSourceList.cxx')
-rw-r--r-- | Source/cmCreateTestSourceList.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 75c25e3..af3c768 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -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; } |