ENH: don't add package target if no package file is around

This commit is contained in:
Bill Hoffman 2006-04-20 15:49:37 -04:00
parent 350c3efe7b
commit 0952ff6f4b

View File

@ -1309,10 +1309,13 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
{ {
depends.push_back("preinstall"); depends.push_back("preinstall");
} }
(*targets)[this->GetPackageTargetName()] if(cmSystemTools::FileExists(configFile.c_str()))
= this->CreateGlobalTarget(this->GetPackageTargetName(), {
"Run CPack packaging tool...", &cpackCommandLines, depends); (*targets)[this->GetPackageTargetName()]
= this->CreateGlobalTarget(this->GetPackageTargetName(),
"Run CPack packaging tool...",
&cpackCommandLines, depends);
}
// CPack source // CPack source
const char* packageSourceTargetName = this->GetPackageSourceTargetName(); const char* packageSourceTargetName = this->GetPackageSourceTargetName();
if ( packageSourceTargetName ) if ( packageSourceTargetName )
@ -1324,11 +1327,15 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
singleLine.push_back("--config"); singleLine.push_back("--config");
configFile = mf->GetStartOutputDirectory();; configFile = mf->GetStartOutputDirectory();;
configFile += "/CPackSourceConfig.cmake"; configFile += "/CPackSourceConfig.cmake";
singleLine.push_back(configFile); if(cmSystemTools::FileExists(configFile.c_str()))
cpackCommandLines.push_back(singleLine); {
(*targets)[packageSourceTargetName] singleLine.push_back(configFile);
= this->CreateGlobalTarget(packageSourceTargetName, cpackCommandLines.push_back(singleLine);
"Run CPack packaging tool for source...", &cpackCommandLines, depends); (*targets)[packageSourceTargetName]
= this->CreateGlobalTarget(packageSourceTargetName,
"Run CPack packaging tool for source...",
&cpackCommandLines, depends);
}
} }
// Test // Test