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,7 +1313,10 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
= this->CreateGlobalTarget(this->GetPackageTargetName(),
"Run CPack packaging tool...", &cpackCommandLines, depends);
// CPack
// CPack source
const char* packageSourceTargetName = this->GetPackageSourceTargetName();
if ( packageSourceTargetName )
{
cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
singleLine.erase(singleLine.begin(), singleLine.end());
depends.erase(depends.begin(), depends.end());
@ -1323,9 +1326,10 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
configFile += "/CPackSourceConfig.cmake";
singleLine.push_back(configFile);
cpackCommandLines.push_back(singleLine);
(*targets)[this->GetPackageSourceTargetName()]
= this->CreateGlobalTarget(this->GetPackageSourceTargetName(),
(*targets)[packageSourceTargetName]
= this->CreateGlobalTarget(packageSourceTargetName,
"Run CPack packaging tool for source...", &cpackCommandLines, depends);
}
// Test
if(mf->IsOn("CMAKE_TESTING_ENABLED"))