From 609af7734ff14a04721463eb969f8ebb1a8de49c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 9 Dec 2023 15:06:36 -0500 Subject: cmCreateTestSourceList: simplify string operations Use `cmStrCat` where possible and use character literals instead of length-1 string literals. --- Source/cmCreateTestSourceList.cxx | 14 ++++++-------- 1 file 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 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 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 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 const& args, for (i = testsBegin; i != tests.end(); ++i) { cmSourceFile* sf = mf.GetOrCreateSource(*i); sf->SetProperty("ABSTRACT", "0"); - sourceListValue += ";"; + sourceListValue += ';'; sourceListValue += *i; } -- cgit v0.12 From a29ca55b1fe69c75b54c09707b68b8057befe6d6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 9 Dec 2023 15:07:05 -0500 Subject: create_test_sourcelist: use the full path to the driver When using `FILE_SET` syntax, full paths to out-of-source files are needed as they are not searched for. --- Help/release/dev/create_test_sourcelist-full-filepath.rst | 5 +++++ Source/cmCreateTestSourceList.cxx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/create_test_sourcelist-full-filepath.rst diff --git a/Help/release/dev/create_test_sourcelist-full-filepath.rst b/Help/release/dev/create_test_sourcelist-full-filepath.rst new file mode 100644 index 0000000..1afa82c --- /dev/null +++ b/Help/release/dev/create_test_sourcelist-full-filepath.rst @@ -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. diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index af3c768..9edbafe 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -135,7 +135,7 @@ bool cmCreateTestSourceList(std::vector 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); -- cgit v0.12