diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 503c455f9..be7896df1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2041,24 +2041,37 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen) } } +bool cmGlobalGenerator::IsExcluded(cmState::Snapshot const& rootSnp, + cmState::Snapshot const& snp_) const +{ + cmState::Snapshot snp = snp_; + while (snp.IsValid()) + { + if(snp == rootSnp) + { + // No directory excludes itself. + return false; + } + + if(snp.GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL")) + { + // This directory is excluded from its parent. + return true; + } + snp = snp.GetBuildsystemDirectoryParent(); + } + return false; +} + bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const { - if(!gen || gen == root) - { - // No directory excludes itself. - return false; - } + assert(gen); - if(gen->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL")) - { - // This directory is excluded from its parent. - return true; - } + cmState::Snapshot rootSnp = root->GetStateSnapshot(); + cmState::Snapshot snp = gen->GetStateSnapshot(); - // This directory is included in its parent. Check whether the - // parent is excluded. - return this->IsExcluded(root, gen->GetParent()); + return this->IsExcluded(rootSnp, snp); } bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, @@ -2070,12 +2083,9 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, // This target is excluded from its directory. return true; } - else - { - // This target is included in its directory. Check whether the - // directory is excluded. - return this->IsExcluded(root, target->GetLocalGenerator()); - } + // This target is included in its directory. Check whether the + // directory is excluded. + return this->IsExcluded(root, target->GetLocalGenerator()); } void diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index fe710f195..23501bc00 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -396,6 +396,8 @@ protected: // has been populated. void FillProjectMap(); void CheckLocalGenerators(); + bool IsExcluded(cmState::Snapshot const& root, + cmState::Snapshot const& snp) const; bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const; bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const; virtual void InitializeProgressMarks() {} diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index b240924b6..8c8c56e8b 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -936,14 +936,25 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks() cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); + cmLocalGenerator* tlg = gt->GetLocalGenerator(); + + if(gt->GetType() == cmTarget::INTERFACE_LIBRARY + || gt->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) + { + continue; + } + + cmState::Snapshot csnp = lg->GetStateSnapshot(); + cmState::Snapshot tsnp = tlg->GetStateSnapshot(); + // Consider the directory containing the target and all its // parents until something excludes the target. - for(cmLocalGenerator* clg = lg; clg && !this->IsExcluded(clg, gt); - clg = clg->GetParent()) + for( ; csnp.IsValid() && !this->IsExcluded(csnp, tsnp); + csnp = csnp.GetBuildsystemDirectoryParent()) { // This local generator includes the target. std::set& targetSet = - this->DirectoryTargetsMap[clg->GetStateSnapshot()]; + this->DirectoryTargetsMap[csnp]; targetSet.insert(gt); // Add dependencies of the included target. An excluded diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 53fdae0d6..4e4c2c6a1 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -1701,3 +1701,13 @@ std::vector cmState::Directory::GetPropertyKeys() const } return keys; } + +bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs) +{ + return lhs.Position == rhs.Position; +} + +bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs) +{ + return lhs.Position != rhs.Position; +} diff --git a/Source/cmState.h b/Source/cmState.h index e503cd258..d68306828 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -93,6 +93,10 @@ public: }; private: + friend bool operator==(const cmState::Snapshot& lhs, + const cmState::Snapshot& rhs); + friend bool operator!=(const cmState::Snapshot& lhs, + const cmState::Snapshot& rhs); friend class cmState; friend class Directory; friend struct StrictWeakOrder; @@ -314,4 +318,7 @@ private: bool MSYSShell; }; +bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs); +bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs); + #endif