From 0952ff6f4b1159268604d7b3622d093af44e349a Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 20 Apr 2006 15:49:37 -0400 Subject: ENH: don't add package target if no package file is around --- Source/cmGlobalGenerator.cxx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 1ad42ca..c151ea4 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1309,10 +1309,13 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { depends.push_back("preinstall"); } - (*targets)[this->GetPackageTargetName()] - = this->CreateGlobalTarget(this->GetPackageTargetName(), - "Run CPack packaging tool...", &cpackCommandLines, depends); - + if(cmSystemTools::FileExists(configFile.c_str())) + { + (*targets)[this->GetPackageTargetName()] + = this->CreateGlobalTarget(this->GetPackageTargetName(), + "Run CPack packaging tool...", + &cpackCommandLines, depends); + } // CPack source const char* packageSourceTargetName = this->GetPackageSourceTargetName(); if ( packageSourceTargetName ) @@ -1324,11 +1327,15 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) 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); + if(cmSystemTools::FileExists(configFile.c_str())) + { + singleLine.push_back(configFile); + cpackCommandLines.push_back(singleLine); + (*targets)[packageSourceTargetName] + = this->CreateGlobalTarget(packageSourceTargetName, + "Run CPack packaging tool for source...", + &cpackCommandLines, depends); + } } // Test -- cgit v0.12