diff options
author | Brad King <brad.king@kitware.com> | 2019-09-30 13:34:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-30 13:34:57 (GMT) |
commit | dce58afd30b781bd99a1af5c6860583577d58a1f (patch) | |
tree | 7bcd7f200b957f10648dc34e722f1cfa56e0884a /Source | |
parent | c88cf48bbe775c45c36c23b990c89d85b7b9a220 (diff) | |
parent | 013d7dd48420b7040355066724ede9eb7050c94a (diff) | |
download | CMake-dce58afd30b781bd99a1af5c6860583577d58a1f.zip CMake-dce58afd30b781bd99a1af5c6860583577d58a1f.tar.gz CMake-dce58afd30b781bd99a1af5c6860583577d58a1f.tar.bz2 |
Merge branch 'backport-3.15-fix-EXCLUDE_FROM_ALL-subdir-all'
Resolve conflicts with changes since the 3.15 series:
* Convert `cmSystemTools::IsOn` => `cmIsOn`.
* Move one "EXCLUDE_FROM_ALL" target property logic fix to
its new location in `cmMakefile::AddNewUtilityTarget`.
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 c4974f3..a75e2ed 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2037,10 +2037,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 cmIsOn(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 3075c1a..cf9c951 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -511,7 +511,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 7aa231e..dca783f 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 0b211b8..4ce3d5e 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -230,6 +230,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); @@ -460,8 +468,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". { @@ -469,9 +482,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> @@ -685,6 +695,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(); @@ -739,7 +758,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 0bc08a5..0f939cc 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -214,7 +214,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 4202175..f42218b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -563,7 +563,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( cmObjectLibraryCommands::Accept); } - 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 82dc943..fed8be5 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -89,7 +89,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 a528fc6..640f823 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1776,7 +1776,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"); } @@ -2051,9 +2051,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); @@ -2066,7 +2064,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); @@ -2093,7 +2091,7 @@ cmTarget* cmMakefile::AddNewUtilityTarget(const std::string& utilityName, { cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName); target->SetIsGeneratorProvided(origin == cmCommandOrigin::Generator); - if (excludeFromAll || this->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { + if (excludeFromAll) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } return target; |