diff options
author | Brad King <brad.king@kitware.com> | 2019-09-30 09:19:21 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-30 09:19:21 -0400 |
commit | 05d7ca14e99ee8ad36da01ddb314d0b90ab41874 (patch) | |
tree | c923027983a11aef0edb53946ab94aa5fc5f1e2d /Source | |
parent | 156b56480a786db4d967bde5eb6d5edee56a27d0 (diff) | |
parent | b3b1c7bf3afc8f33fa69b79f47f778cb781ac3c7 (diff) | |
download | cmake-05d7ca14e99ee8ad36da01ddb314d0b90ab41874.tar.gz |
Merge branch 'backport-3.14-fix-EXCLUDE_FROM_ALL-subdir-all'
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 10 |
8 files changed, 25 insertions, 17 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6b001f2d5b..ea898e175e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2088,10 +2088,18 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, return this->IsExcluded(rootSnp, snp); } -bool cmGlobalGenerator::IsExcluded(cmGeneratorTarget* target) const +bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, + cmGeneratorTarget* target) const { - return target->GetType() == cmStateEnums::INTERFACE_LIBRARY || - target->GetPropertyAsBool("EXCLUDE_FROM_ALL"); + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + return true; + } + if (const char* exclude = target->GetProperty("EXCLUDE_FROM_ALL")) { + return cmSystemTools::IsOn(exclude); + } + // This target is included in its directory. Check whether the + // directory is excluded. + return this->IsExcluded(root, target->GetLocalGenerator()); } void cmGlobalGenerator::GetEnabledLanguages( diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index db964892a4..5008534446 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -509,7 +509,7 @@ protected: bool IsExcluded(cmStateSnapshot const& root, cmStateSnapshot const& snp) const; bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const; - bool IsExcluded(cmGeneratorTarget* target) const; + bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const; virtual void InitializeProgressMarks() {} struct GlobalTargetInfo diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 15dd4044e3..04d8e37aea 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -302,9 +302,9 @@ public: return LocalGenerators; } - bool IsExcluded(cmGeneratorTarget* target) + bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) { - return cmGlobalGenerator::IsExcluded(target); + return cmGlobalGenerator::IsExcluded(root, target); } int GetRuleCmdLength(const std::string& name) { return RuleCmdLength[name]; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index c63633469a..4eb2252e98 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -718,7 +718,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( localName, depends, commands, true); // add the all/all dependency - if (!this->IsExcluded(gtarget)) { + if (!this->IsExcluded(this->LocalGenerators[0], gtarget)) { depends.clear(); depends.push_back(localName); commands.clear(); @@ -782,7 +782,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( "Pre-install relink rule for target.", localName, depends, commands, true); - if (!this->IsExcluded(gtarget)) { + if (!this->IsExcluded(this->LocalGenerators[0], gtarget)) { depends.clear(); depends.push_back(localName); commands.clear(); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index cd0355f6f5..cc97cef096 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -208,7 +208,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() tgt->IsImported()) { continue; } - if (!this->IsExcluded(tgt)) { + if (!this->IsExcluded(gen[0], tgt)) { allBuild->AddUtility(tgt->GetName()); } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7c2bcd3865..9d725282bc 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -571,7 +571,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( false, "", "", false, cmMakefile::AcceptObjectLibraryCommands); } - if (!this->IsExcluded(target)) { + if (!this->IsExcluded(gens[0], target)) { allbuild->AddUtility(target->GetName()); } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 81cafa3218..90666fc180 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -88,7 +88,9 @@ void cmLocalNinjaGenerator::Generate() if (tg) { tg->Generate(); // Add the target to "all" if required. - if (!this->GetGlobalNinjaGenerator()->IsExcluded(target)) { + if (!this->GetGlobalNinjaGenerator()->IsExcluded( + this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], + target)) { this->GetGlobalNinjaGenerator()->AddDependencyToAll(target); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e0f69cb4ba..3f8bd4e41f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1166,7 +1166,7 @@ cmTarget* cmMakefile::AddUtilityCommand( // Create a target instance for this utility. cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName); target->SetIsGeneratorProvided(origin == TargetOrigin::Generator); - if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { + if (excludeFromAll) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } if (!comment) { @@ -1716,7 +1716,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot); this->GetGlobalGenerator()->AddMakefile(subMf); - if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { + if (excludeFromAll) { subMf->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } @@ -2010,9 +2010,7 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname, // over changes in CMakeLists.txt, making the information stale and // hence useless. target->ClearDependencyInformation(*this); - if (excludeFromAll || - (type != cmStateEnums::INTERFACE_LIBRARY && - this->GetPropertyAsBool("EXCLUDE_FROM_ALL"))) { + if (excludeFromAll) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } target->AddSources(srcs); @@ -2025,7 +2023,7 @@ cmTarget* cmMakefile::AddExecutable(const std::string& exeName, bool excludeFromAll) { cmTarget* target = this->AddNewTarget(cmStateEnums::EXECUTABLE, exeName); - if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { + if (excludeFromAll) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } target->AddSources(srcs); |