CMake code rely on cmList class for CMake lists management (part. 1)

This commit is contained in:
Marc Chevrier
2023-04-14 16:48:16 +02:00
parent 51b0d45d91
commit e08ba229ee
77 changed files with 374 additions and 381 deletions

View File

@@ -29,6 +29,7 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmList.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -1434,7 +1435,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
this->Makefile->GetSafeDefinition("CMAKE_DEPENDS_DEPENDENCY_FILES");
if (!depends.empty()) {
// dependencies are managed by compiler
auto depFiles = cmExpandedList(depends, true);
cmList depFiles{ depends, cmList::EmptyElements::Yes };
std::string const internalDepFile =
targetDir + "/compiler_depend.internal";
std::string const depFile = targetDir + "/compiler_depend.make";
@@ -1556,8 +1557,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
this->WriteDisclaimer(internalRuleFileStream);
// for each language we need to scan, scan it
std::vector<std::string> langs =
cmExpandedList(mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"));
cmList langs{ mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES") };
for (std::string const& lang : langs) {
// construct the checker
// Create the scanner for this language
@@ -1602,7 +1602,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
}
// Convert the string to a list and preserve empty entries.
std::vector<std::string> pairs = cmExpandedList(*pairs_string, true);
cmList pairs{ *pairs_string, cmList::EmptyElements::Yes };
for (auto i = pairs.begin(); i != pairs.end() && (i + 1) != pairs.end();) {
const std::string& depender = *i++;
const std::string& dependee = *i++;
@@ -1822,7 +1822,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
if (!infoDef) {
return;
}
std::vector<std::string> files = cmExpandedList(*infoDef);
cmList files{ *infoDef };
// Each depend information file corresponds to a target. Clear the
// dependencies for that target.
@@ -1863,7 +1863,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
cmSystemTools::Touch(DepTimestamp.GenericString(), true);
// clear the dependencies files generated by the compiler
std::vector<std::string> dependencies = cmExpandedList(depsFiles, true);
cmList dependencies{ depsFiles, cmList::EmptyElements::Yes };
cmDependsCompiler depsManager;
depsManager.SetVerbose(verbose);
depsManager.ClearDependencies(dependencies);