diff options
author | Brad King <brad.king@kitware.com> | 2019-09-30 14:29:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-30 14:29:11 (GMT) |
commit | e7637a3d1ad48f675050483199cb98565983d622 (patch) | |
tree | 0c474ad194d25e3634633521616f311bb89cf398 /Source | |
parent | 5a35a9c70d1dc92ec70a6ff454bc9441fa410968 (diff) | |
parent | 013d7dd48420b7040355066724ede9eb7050c94a (diff) | |
download | CMake-e7637a3d1ad48f675050483199cb98565983d622.zip CMake-e7637a3d1ad48f675050483199cb98565983d622.tar.gz CMake-e7637a3d1ad48f675050483199cb98565983d622.tar.bz2 |
Merge branch 'backport-3.15-fix-EXCLUDE_FROM_ALL-subdir-all' into release-3.15
Merge-request: !3863
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 | 31 | ||||
-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, 48 insertions, 21 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6b001f2..ea898e1 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 db96489..5008534 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 15dd404..04d8e37 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 aa584ad..4eb2252 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -232,6 +232,14 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() depends.push_back(this->EmptyRuleHackDepends); } + // Write and empty all: + lg->WriteMakeRule(makefileStream, "The main recursive all target", "all", + depends, no_commands, true); + + // Write an empty preinstall: + lg->WriteMakeRule(makefileStream, "The main recursive preinstall target", + "preinstall", depends, no_commands, true); + // Write out the "special" stuff lg->WriteSpecialTargetsTop(makefileStream); @@ -473,8 +481,13 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( ruleFileStream << "\n\n"; } - // Write directory-level rules for "all". - this->WriteDirectoryRule2(ruleFileStream, lg, "all", true, false); + if (!lg->IsRootMakefile()) { + // Write directory-level rules for "all". + this->WriteDirectoryRule2(ruleFileStream, lg, "all", true, false); + + // Write directory-level rules for "preinstall". + this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", true, true); + } // Write directory-level rules for "clean". { @@ -482,9 +495,6 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( lg->AppendDirectoryCleanCommand(cmds); this->WriteDirectoryRule2(ruleFileStream, lg, "clean", false, false, cmds); } - - // Write directory-level rules for "preinstall". - this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", true, true); } std::vector<cmGlobalGenerator::GeneratedMakeCommand> @@ -707,6 +717,15 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", localName, depends, commands, true); + // add the all/all dependency + if (!this->IsExcluded(this->LocalGenerators[0], gtarget)) { + depends.clear(); + depends.push_back(localName); + commands.clear(); + lg->WriteMakeRule(ruleFileStream, "Include target in all.", "all", + depends, commands, true); + } + // Write the rule. commands.clear(); @@ -763,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 cd0355f..cc97cef 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 7c2bcd3..9d72528 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 81cafa3..90666fc 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 e0f69cb..3f8bd4e 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); |