summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-25 18:09:43 (GMT)
committerBrad King <brad.king@kitware.com>2019-09-30 14:30:28 (GMT)
commit0733a94f648d63e8492fbcff3413cef461cb18d8 (patch)
tree516ebdb91a4fa5e832c9e3f89fd22d7bea22315d /Source
parent11fb377eb96e6a90ea96126a2d22739f6983182a (diff)
downloadCMake-0733a94f648d63e8492fbcff3413cef461cb18d8.zip
CMake-0733a94f648d63e8492fbcff3413cef461cb18d8.tar.gz
CMake-0733a94f648d63e8492fbcff3413cef461cb18d8.tar.bz2
Ninja,Makefile: Fix subdir "all" with nested EXCLUDE_FROM_ALL subdir
The "all" target defined for a subdirectory (e.g. `cd sub; make` or `ninja sub/all`) should not include the "all" targets from nested subdirectories (e.g. `sub/sub`) that are marked as `EXCLUDE_FROM_ALL`. Fix this and add a test case. Issue: #19753 Co-Author: Sebastian Holtermann <sebholt@xwmw.org>
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx3
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx3
2 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 3a3c5fb..0339193 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1123,6 +1123,9 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
for (cmStateSnapshot const& state : lg->GetStateSnapshot().GetChildren()) {
+ if (state.GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
+ continue;
+ }
std::string const& currentBinaryDir =
state.GetDirectory().GetCurrentBinary();
folderTargets.push_back(
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 4ce3d5e..df4673d 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -429,6 +429,9 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
for (cmStateSnapshot const& c : lg->GetStateSnapshot().GetChildren()) {
+ if (check_all && c.GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
+ continue;
+ }
std::string subdir =
cmStrCat(c.GetDirectory().GetCurrentBinary(), '/', pass);
depends.push_back(std::move(subdir));