Merge topic 'create_test_sourcelist-full-filepath'

a29ca55b1f create_test_sourcelist: use the full path to the driver
609af7734f cmCreateTestSourceList: simplify string operations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9060
This commit is contained in:
Brad King
2023-12-12 13:41:50 +00:00
committed by Kitware Robot
2 changed files with 12 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
create_test_sourcelist-full-filepath
------------------------------------
* The :command:`create_test_sourcelist` command now provides a full path to
the generated driver source file.

View File

@@ -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);
}
@@ -137,12 +135,12 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
{
cmSourceFile* sf = mf.GetOrCreateSource(driver);
sf->SetProperty("ABSTRACT", "0");
sourceListValue = args[1];
sourceListValue = driver;
}
for (i = testsBegin; i != tests.end(); ++i) {
cmSourceFile* sf = mf.GetOrCreateSource(*i);
sf->SetProperty("ABSTRACT", "0");
sourceListValue += ";";
sourceListValue += ';';
sourceListValue += *i;
}