From 71b370c79c741f9399d9ea85b854e5c13f889a2d Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Mon, 17 Apr 2006 16:06:31 -0400 Subject: BUG: Verify the global target name exists before using it. Fixes VS and Xcode --- Source/cmGlobalGenerator.cxx | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b44c44f..1ad42ca 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1313,19 +1313,23 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) = this->CreateGlobalTarget(this->GetPackageTargetName(), "Run CPack packaging tool...", &cpackCommandLines, depends); - // CPack - cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); - singleLine.erase(singleLine.begin(), singleLine.end()); - depends.erase(depends.begin(), depends.end()); - singleLine.push_back(this->GetCMakeInstance()->GetCPackCommand()); - singleLine.push_back("--config"); - configFile = mf->GetStartOutputDirectory();; - configFile += "/CPackSourceConfig.cmake"; - singleLine.push_back(configFile); - cpackCommandLines.push_back(singleLine); - (*targets)[this->GetPackageSourceTargetName()] - = this->CreateGlobalTarget(this->GetPackageSourceTargetName(), - "Run CPack packaging tool for source...", &cpackCommandLines, depends); + // 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()); + singleLine.push_back(this->GetCMakeInstance()->GetCPackCommand()); + singleLine.push_back("--config"); + configFile = mf->GetStartOutputDirectory();; + configFile += "/CPackSourceConfig.cmake"; + singleLine.push_back(configFile); + cpackCommandLines.push_back(singleLine); + (*targets)[packageSourceTargetName] + = this->CreateGlobalTarget(packageSourceTargetName, + "Run CPack packaging tool for source...", &cpackCommandLines, depends); + } // Test if(mf->IsOn("CMAKE_TESTING_ENABLED")) -- cgit v0.12