summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-30 14:26:37 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-09-30 14:27:15 (GMT)
commit8aa5f6ba446dd8ff817e54979f466b8a247f967a (patch)
tree73ac7f0c03a2f1f7c3c2b115d301f21b205e8ef0 /Source
parent9b03baee308d78db119554def6e34fd9db9683ac (diff)
parentdce58afd30b781bd99a1af5c6860583577d58a1f (diff)
downloadCMake-8aa5f6ba446dd8ff817e54979f466b8a247f967a.zip
CMake-8aa5f6ba446dd8ff817e54979f466b8a247f967a.tar.gz
CMake-8aa5f6ba446dd8ff817e54979f466b8a247f967a.tar.bz2
Merge topic 'fix-EXCLUDE_FROM_ALL-subdir-all'
dce58afd30 Merge branch 'backport-3.15-fix-EXCLUDE_FROM_ALL-subdir-all' 013d7dd484 Help: Mention 3.14.7 EXCLUDE_FROM_ALL fix in 3.15.4 release note 61103c0bac Merge branch 'backport-3.14-fix-EXCLUDE_FROM_ALL-subdir-all' 1fe4501592 Help: Add release note for EXCLUDE_FROM_ALL fix in 3.15.4 05d7ca14e9 Merge branch 'backport-3.14-fix-EXCLUDE_FROM_ALL-subdir-all' 62d45d91e8 Help: Add release note for EXCLUDE_FROM_ALL fix in 3.14.7 b3b1c7bf3a Restore "all" target in subdirectories marked EXCLUDE_FROM_ALL 156b56480a Makefiles: Revert "Make build root targets ... recursive" ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3863
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx14
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalNinjaGenerator.h4
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx31
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmLocalNinjaGenerator.cxx4
-rw-r--r--Source/cmMakefile.cxx10
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 264a73a..d9fbe9d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1777,7 +1777,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");
}
@@ -2052,9 +2052,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);
@@ -2067,7 +2065,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);
@@ -2094,7 +2092,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;