summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-26 18:35:55 (GMT)
committerBrad King <brad.king@kitware.com>2019-09-30 14:30:28 (GMT)
commita49cd4d1a75f20180a349cdfea3fd384eedf3e8b (patch)
tree3edd9abcc211551c1c30f580b40345906d083210 /Source/cmGlobalNinjaGenerator.cxx
parent0733a94f648d63e8492fbcff3413cef461cb18d8 (diff)
downloadCMake-a49cd4d1a75f20180a349cdfea3fd384eedf3e8b.zip
CMake-a49cd4d1a75f20180a349cdfea3fd384eedf3e8b.tar.gz
CMake-a49cd4d1a75f20180a349cdfea3fd384eedf3e8b.tar.bz2
Ninja: Fix EXCLUDE_FROM_ALL OFF on sub/sub/tgt in sub/all
Defer adding a test to a later commit after all generators have been fixed. Issue: #19753
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 0339193..62106ac 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1114,8 +1114,25 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
type == cmStateEnums::SHARED_LIBRARY ||
type == cmStateEnums::MODULE_LIBRARY ||
type == cmStateEnums::OBJECT_LIBRARY ||
- type == cmStateEnums::UTILITY) &&
- !gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
+ type == cmStateEnums::UTILITY)) {
+ if (const char* exclude = gt->GetProperty("EXCLUDE_FROM_ALL")) {
+ if (cmIsOn(exclude)) {
+ // This target has been explicitly excluded.
+ continue;
+ }
+ // This target has been explicitly un-excluded. The directory-level
+ // rule for every directory between this and the root (exclusive)
+ // should depend on the target-level rule for this target.
+ cmStateSnapshot dir =
+ lg->GetStateSnapshot().GetBuildsystemDirectoryParent();
+ cmStateSnapshot parent = dir.GetBuildsystemDirectoryParent();
+ while (parent.IsValid()) {
+ std::string const& folder = dir.GetDirectory().GetCurrentBinary();
+ targetsPerFolder[folder].push_back(gt->GetName());
+ dir = parent;
+ parent = parent.GetBuildsystemDirectoryParent();
+ }
+ }
folderTargets.push_back(gt->GetName());
}
}