mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
cmLocalVisualStudio7Generator: Adopt SourcesVisited lookup table
Move it up the hierarchy from `cmLocalVisualStudio10Generator`. Propagate contents from a target's dependencies as part of the main target iteration logic instead of as part of the generator-specific target generation.
This commit is contained in:
@@ -68,13 +68,6 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
|
|||||||
|
|
||||||
void cmLocalVisualStudio10Generator::GenerateTarget(cmGeneratorTarget* target)
|
void cmLocalVisualStudio10Generator::GenerateTarget(cmGeneratorTarget* target)
|
||||||
{
|
{
|
||||||
auto& targetVisited = this->GetSourcesVisited(target);
|
|
||||||
auto& deps = this->GlobalGenerator->GetTargetDirectDepends(target);
|
|
||||||
for (auto& d : deps) {
|
|
||||||
// Take the union of visited source files of custom commands
|
|
||||||
auto depVisited = this->GetSourcesVisited(d);
|
|
||||||
targetVisited.insert(depVisited.begin(), depVisited.end());
|
|
||||||
}
|
|
||||||
if (static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
|
if (static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
|
||||||
->TargetIsFortranOnly(target)) {
|
->TargetIsFortranOnly(target)) {
|
||||||
this->cmLocalVisualStudio7Generator::GenerateTarget(target);
|
this->cmLocalVisualStudio7Generator::GenerateTarget(target);
|
||||||
|
@@ -28,19 +28,10 @@ public:
|
|||||||
void ReadAndStoreExternalGUID(const std::string& name,
|
void ReadAndStoreExternalGUID(const std::string& name,
|
||||||
const char* path) override;
|
const char* path) override;
|
||||||
|
|
||||||
std::set<cmSourceFile const*>& GetSourcesVisited(
|
|
||||||
cmGeneratorTarget const* target)
|
|
||||||
{
|
|
||||||
return SourcesVisited[target];
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char* ReportErrorLabel() const override;
|
const char* ReportErrorLabel() const override;
|
||||||
bool CustomCommandUseLocal() const override { return true; }
|
bool CustomCommandUseLocal() const override { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void GenerateTarget(cmGeneratorTarget* target) override;
|
void GenerateTarget(cmGeneratorTarget* target) override;
|
||||||
|
|
||||||
std::map<cmGeneratorTarget const*, std::set<cmSourceFile const*>>
|
|
||||||
SourcesVisited;
|
|
||||||
};
|
};
|
||||||
|
@@ -86,6 +86,15 @@ void cmLocalVisualStudio7Generator::Generate()
|
|||||||
if (!gt->IsInBuildSystem() || gt->GetProperty("EXTERNAL_MSPROJECT")) {
|
if (!gt->IsInBuildSystem() || gt->GetProperty("EXTERNAL_MSPROJECT")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto& gtVisited = this->GetSourcesVisited(gt);
|
||||||
|
auto& deps = this->GlobalGenerator->GetTargetDirectDepends(gt);
|
||||||
|
for (auto& d : deps) {
|
||||||
|
// Take the union of visited source files of custom commands
|
||||||
|
auto depVisited = this->GetSourcesVisited(d);
|
||||||
|
gtVisited.insert(depVisited.begin(), depVisited.end());
|
||||||
|
}
|
||||||
|
|
||||||
this->GenerateTarget(gt);
|
this->GenerateTarget(gt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -83,6 +83,12 @@ public:
|
|||||||
virtual void ReadAndStoreExternalGUID(const std::string& name,
|
virtual void ReadAndStoreExternalGUID(const std::string& name,
|
||||||
const char* path);
|
const char* path);
|
||||||
|
|
||||||
|
std::set<cmSourceFile const*>& GetSourcesVisited(
|
||||||
|
cmGeneratorTarget const* target)
|
||||||
|
{
|
||||||
|
return this->SourcesVisited[target];
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void GenerateTarget(cmGeneratorTarget* target);
|
virtual void GenerateTarget(cmGeneratorTarget* target);
|
||||||
|
|
||||||
@@ -148,4 +154,7 @@ private:
|
|||||||
bool FortranProject;
|
bool FortranProject;
|
||||||
bool WindowsCEProject;
|
bool WindowsCEProject;
|
||||||
std::unique_ptr<cmLocalVisualStudio7GeneratorInternals> Internal;
|
std::unique_ptr<cmLocalVisualStudio7GeneratorInternals> Internal;
|
||||||
|
|
||||||
|
std::map<cmGeneratorTarget const*, std::set<cmSourceFile const*>>
|
||||||
|
SourcesVisited;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user