ENH: Properly handle target dependencies

This commit is contained in:
Andy Cedilnik 2006-02-23 17:30:12 -05:00
parent 542b034a66
commit 66ea097554
2 changed files with 18 additions and 8 deletions

View File

@ -1237,8 +1237,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
singleLine.push_back(this->GetCMakeInstance()->GetCTestCommand()); singleLine.push_back(this->GetCMakeInstance()->GetCTestCommand());
singleLine.push_back("--force-new-ctest-process"); singleLine.push_back("--force-new-ctest-process");
cpackCommandLines.push_back(singleLine); cpackCommandLines.push_back(singleLine);
(*targets)[this->GetPackageTargetName()] (*targets)[this->GetTestTargetName()]
= this->CreateGlobalTarget(this->GetPackageTargetName(), = this->CreateGlobalTarget(this->GetTestTargetName(),
"Running tests...", &cpackCommandLines, depends); "Running tests...", &cpackCommandLines, depends);
//Edit Cache //Edit Cache
@ -1306,6 +1306,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
singleLine.push_back("-P"); singleLine.push_back("-P");
singleLine.push_back("cmake_install.cmake"); singleLine.push_back("cmake_install.cmake");
cpackCommandLines.push_back(singleLine); cpackCommandLines.push_back(singleLine);
/*
const char* noall = const char* noall =
mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"); mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
bool dependsOnAll = false; bool dependsOnAll = false;
@ -1313,10 +1314,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
{ {
dependsOnAll = true; dependsOnAll = true;
} }
*/
(*targets)[this->GetInstallTargetName()] = (*targets)[this->GetInstallTargetName()] =
this->CreateGlobalTarget( this->CreateGlobalTarget(
this->GetInstallTargetName(), "Install the project...", this->GetInstallTargetName(), "Install the project...",
&cpackCommandLines, depends, dependsOnAll); &cpackCommandLines, depends);
} }
cmTarget cmGlobalGenerator::CreateGlobalTarget( cmTarget cmGlobalGenerator::CreateGlobalTarget(
@ -1330,13 +1332,19 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
target.SetType(cmTarget::GLOBAL_TARGET, name); target.SetType(cmTarget::GLOBAL_TARGET, name);
target.SetInAll(false); target.SetInAll(false);
std::vector<std::string> fileDepends;
// Store the custom command in the target. // Store the custom command in the target.
cmCustomCommand cc(0, depends, *commandLines, 0, 0); cmCustomCommand cc(0, fileDepends, *commandLines, 0, 0);
target.GetPostBuildCommands().push_back(cc); target.GetPostBuildCommands().push_back(cc);
target.SetProperty("EchoString", message); target.SetProperty("EchoString", message);
if ( depends_on_all ) if ( depends_on_all )
{ {
target.SetProperty("DependsOnAll", "ON"); target.AddUtility("all");
}
std::vector<std::string>::iterator dit;
for ( dit = depends.begin(); dit != depends.end(); ++ dit )
{
target.AddUtility(dit->c_str());
} }
return target; return target;
} }

View File

@ -1266,10 +1266,12 @@ void cmLocalUnixMakefileGenerator3
{ {
text = "Running external command ..."; text = "Running external command ...";
} }
const char* dependsOnAll = glIt->second.GetProperty("DependsOnAll"); std::set<cmStdString>::iterator dit;
if ( dependsOnAll || cmSystemTools::IsOn(dependsOnAll) ) for ( dit = glIt->second.GetUtilities().begin();
dit != glIt->second.GetUtilities().end();
++ dit )
{ {
depends.push_back("all"); depends.push_back(dit->c_str());
} }
this->AppendEcho(commands, text); this->AppendEcho(commands, text);