summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx3
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx3
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll.cmake1
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll/SubSub/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll/SubSub/subsub.cpp4
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll/check-sub.cmake1
-rw-r--r--Tests/RunCMake/add_subdirectory/ExcludeFromAll/check.cmake1
8 files changed, 16 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));
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll.cmake b/Tests/RunCMake/add_subdirectory/ExcludeFromAll.cmake
index ff676a6..fbcfe7b 100644
--- a/Tests/RunCMake/add_subdirectory/ExcludeFromAll.cmake
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll.cmake
@@ -11,4 +11,5 @@ set(foo_lib \"$<TARGET_FILE:foo>\")
set(bar_lib \"$<TARGET_FILE:bar>\")
set(zot_lib \"$<TARGET_FILE:zot>\")
set(subinc_lib \"$<TARGET_FILE:subinc>\")
+set(subsub_lib \"$<TARGET_FILE:subsub>\")
")
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt
index 790da54..9ed9e55 100644
--- a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/CMakeLists.txt
@@ -1,5 +1,7 @@
project(ExcludeFromAllSub NONE)
+add_subdirectory(SubSub EXCLUDE_FROM_ALL)
+
add_library(bar STATIC EXCLUDE_FROM_ALL bar.cpp)
add_library(zot STATIC zot.cpp)
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/SubSub/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/SubSub/CMakeLists.txt
new file mode 100644
index 0000000..14f7973
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/SubSub/CMakeLists.txt
@@ -0,0 +1 @@
+add_library(subsub STATIC subsub.cpp)
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/SubSub/subsub.cpp b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/SubSub/subsub.cpp
new file mode 100644
index 0000000..ca689ed
--- /dev/null
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/SubSub/subsub.cpp
@@ -0,0 +1,4 @@
+int subsub()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check-sub.cmake b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check-sub.cmake
index 297ad1e..afacf6e 100644
--- a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check-sub.cmake
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check-sub.cmake
@@ -18,6 +18,7 @@ if(EXISTS ${RunCMake_TEST_BINARY_DIR}/check-debug.cmake)
foreach(file
"${main_exe}"
"${bar_lib}"
+ "${subsub_lib}"
)
if(EXISTS "${file}")
set(RunCMake_TEST_FAILED
diff --git a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check.cmake b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check.cmake
index 433c032..b229f4c 100644
--- a/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check.cmake
+++ b/Tests/RunCMake/add_subdirectory/ExcludeFromAll/check.cmake
@@ -21,6 +21,7 @@ if(EXISTS ${RunCMake_TEST_BINARY_DIR}/check-debug.cmake)
foreach(file
"${zot_lib}"
"${bar_lib}"
+ "${subsub_lib}"
)
if(EXISTS "${file}")
set(RunCMake_TEST_FAILED