cmGlobalVisualStudio8Generator: Collect CMake input files earlier

This commit is contained in:
Alexander Neundorf 2023-02-27 22:56:26 +01:00 committed by Brad King
parent 827d5b75d4
commit 659e9ae937

View File

@ -262,6 +262,17 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmTarget* tgt = lg.AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
std::move(cc));
// Collect the input files used to generate all targets in this
// project.
std::vector<std::string> listFiles;
for (const auto& gen : generators) {
cm::append(listFiles, gen->GetMakefile()->GetListFiles());
}
// Sort the list of input files and remove duplicates.
std::sort(listFiles.begin(), listFiles.end(), std::less<std::string>());
auto new_end = std::unique(listFiles.begin(), listFiles.end());
listFiles.erase(new_end, listFiles.end());
auto ptr = cm::make_unique<cmGeneratorTarget>(tgt, &lg);
auto* gt = ptr.get();
lg.AddGeneratorTarget(std::move(ptr));
@ -295,13 +306,6 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
// The custom rule runs cmake so set UTF-8 pipes.
bool stdPipesUTF8 = true;
// Collect the input files used to generate all targets in this
// project.
std::vector<std::string> listFiles;
for (const auto& gen : generators) {
cm::append(listFiles, gen->GetMakefile()->GetListFiles());
}
// Add a custom prebuild target to run the VerifyGlobs script.
cmake* cm = this->GetCMakeInstance();
if (cm->DoWriteGlobVerifyTarget()) {
@ -325,11 +329,6 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
listFiles.push_back(cm->GetGlobVerifyStamp());
}
// Sort the list of input files and remove duplicates.
std::sort(listFiles.begin(), listFiles.end(), std::less<std::string>());
auto new_end = std::unique(listFiles.begin(), listFiles.end());
listFiles.erase(new_end, listFiles.end());
// Create a rule to re-run CMake.
std::string argS = cmStrCat("-S", lg.GetSourceDirectory());
std::string argB = cmStrCat("-B", lg.GetBinaryDirectory());