BUG: Verify the global target name exists before using it. Fixes VS and Xcode

This commit is contained in:
Andy Cedilnik 2006-04-17 16:06:31 -04:00
parent d71f723b11
commit 71b370c79c
1 changed files with 17 additions and 13 deletions

View File

@ -1313,19 +1313,23 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
= this->CreateGlobalTarget(this->GetPackageTargetName(), = this->CreateGlobalTarget(this->GetPackageTargetName(),
"Run CPack packaging tool...", &cpackCommandLines, depends); "Run CPack packaging tool...", &cpackCommandLines, depends);
// CPack // CPack source
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); const char* packageSourceTargetName = this->GetPackageSourceTargetName();
singleLine.erase(singleLine.begin(), singleLine.end()); if ( packageSourceTargetName )
depends.erase(depends.begin(), depends.end()); {
singleLine.push_back(this->GetCMakeInstance()->GetCPackCommand()); cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
singleLine.push_back("--config"); singleLine.erase(singleLine.begin(), singleLine.end());
configFile = mf->GetStartOutputDirectory();; depends.erase(depends.begin(), depends.end());
configFile += "/CPackSourceConfig.cmake"; singleLine.push_back(this->GetCMakeInstance()->GetCPackCommand());
singleLine.push_back(configFile); singleLine.push_back("--config");
cpackCommandLines.push_back(singleLine); configFile = mf->GetStartOutputDirectory();;
(*targets)[this->GetPackageSourceTargetName()] configFile += "/CPackSourceConfig.cmake";
= this->CreateGlobalTarget(this->GetPackageSourceTargetName(), singleLine.push_back(configFile);
"Run CPack packaging tool for source...", &cpackCommandLines, depends); cpackCommandLines.push_back(singleLine);
(*targets)[packageSourceTargetName]
= this->CreateGlobalTarget(packageSourceTargetName,
"Run CPack packaging tool for source...", &cpackCommandLines, depends);
}
// Test // Test
if(mf->IsOn("CMAKE_TESTING_ENABLED")) if(mf->IsOn("CMAKE_TESTING_ENABLED"))