summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorWilliam Sciaroni <William.Sciaroni@ngc.com>2023-11-08 16:05:22 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-10 18:19:11 (GMT)
commit5e0c1777a3153fd9b3c1f98e1a584a4525da6141 (patch)
tree1ed15898abd7a04658574ae92108d864f2e887cb /Source
parenteaa00d4dfa5ea7e611fc447d986bb10c41c7b0e1 (diff)
downloadCMake-5e0c1777a3153fd9b3c1f98e1a584a4525da6141.zip
CMake-5e0c1777a3153fd9b3c1f98e1a584a4525da6141.tar.gz
CMake-5e0c1777a3153fd9b3c1f98e1a584a4525da6141.tar.bz2
Optionally make `test` target depend on `all`
Fixes: #8774
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ef0f40f..3f9bcd5 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2865,6 +2865,14 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
gti.Name = this->GetTestTargetName();
gti.Message = "Running tests...";
gti.UsesTerminal = true;
+ // Unlike the 'install' target, the 'test' target does not depend on 'all'
+ // by default. Enable it only if CMAKE_SKIP_TEST_ALL_DEPENDENCY is
+ // explicitly set to OFF.
+ if (cmValue noall = mf->GetDefinition("CMAKE_SKIP_TEST_ALL_DEPENDENCY")) {
+ if (cmIsOff(noall)) {
+ gti.Depends.emplace_back(this->GetAllTargetName());
+ }
+ }
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCTestCommand());
singleLine.push_back("--force-new-ctest-process");