diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-04-20 19:49:37 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-04-20 19:49:37 (GMT) |
commit | 0952ff6f4b1159268604d7b3622d093af44e349a (patch) | |
tree | 895a27d649b2714b0d13365bc9c4131aa60e7b5b | |
parent | 350c3efe7bde6d1cd3e24a309f8c1d9671699a16 (diff) | |
download | CMake-0952ff6f4b1159268604d7b3622d093af44e349a.zip CMake-0952ff6f4b1159268604d7b3622d093af44e349a.tar.gz CMake-0952ff6f4b1159268604d7b3622d093af44e349a.tar.bz2 |
ENH: don't add package target if no package file is around
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 25 |
1 files 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 |