COMP: Remove warnings and style problems

This commit is contained in:
Andy Cedilnik 2006-07-10 07:59:05 -04:00
parent 17eddbd521
commit e918403eee
1 changed files with 40 additions and 28 deletions

View File

@ -87,12 +87,12 @@ int cmCPackGenericGenerator::PrepareNames()
this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory.c_str()); this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory.c_str());
this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName.c_str()); this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName.c_str());
this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PATH", destFile.c_str()); this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PATH", destFile.c_str());
this->SetOptionIfNotSet("CPACK_TEMPORARY_PACKAGE_FILE_NAME", this->SetOptionIfNotSet("CPACK_TEMPORARY_PACKAGE_FILE_NAME",
outFile.c_str()); outFile.c_str());
this->SetOptionIfNotSet("CPACK_INSTALL_DIRECTORY", this->GetInstallPath()); this->SetOptionIfNotSet("CPACK_INSTALL_DIRECTORY", this->GetInstallPath());
this->SetOptionIfNotSet("CPACK_NATIVE_INSTALL_DIRECTORY", this->SetOptionIfNotSet("CPACK_NATIVE_INSTALL_DIRECTORY",
cmsys::SystemTools::ConvertToOutputPath(this->GetInstallPath()).c_str()); cmsys::SystemTools::ConvertToOutputPath(this->GetInstallPath()).c_str());
this->SetOptionIfNotSet("CPACK_TEMPORARY_INSTALL_DIRECTORY", this->SetOptionIfNotSet("CPACK_TEMPORARY_INSTALL_DIRECTORY",
installPrefix.c_str()); installPrefix.c_str());
cmCPackLogger(cmCPackLog::LOG_DEBUG, cmCPackLogger(cmCPackLog::LOG_DEBUG,
@ -178,23 +178,26 @@ int cmCPackGenericGenerator::InstallProject()
// If the CPackConfig file sets CPACK_INSTALL_COMMANDS then run them // If the CPackConfig file sets CPACK_INSTALL_COMMANDS then run them
// as listed // as listed
if ( !this->InstallProjectViaInstallCommands(movable, tempInstallDirectory) ) if ( !this->InstallProjectViaInstallCommands(
movable, tempInstallDirectory) )
{ {
return 0; return 0;
} }
// If the CPackConfig file sets CPACK_INSTALLED_DIRECTORIES // If the CPackConfig file sets CPACK_INSTALLED_DIRECTORIES
// then glob it and copy it to CPACK_TEMPORARY_DIRECTORY // then glob it and copy it to CPACK_TEMPORARY_DIRECTORY
// This is used in Source packageing // This is used in Source packageing
if ( !this->InstallProjectViaInstalledDirectories(movable, tempInstallDirectory) ) if ( !this->InstallProjectViaInstalledDirectories(
movable, tempInstallDirectory) )
{ {
return 0; return 0;
} }
// If the project is a CMAKE project then run pre-install // If the project is a CMAKE project then run pre-install
// and then read the cmake_install script to run it // and then read the cmake_install script to run it
if ( !this->InstallProjectViaInstallCMakeProjects(movable, tempInstallDirectory) ) if ( !this->InstallProjectViaInstallCMakeProjects(
movable, tempInstallDirectory) )
{ {
return 0; return 0;
} }
@ -228,9 +231,9 @@ int cmCPackGenericGenerator::InstallProject()
stripCommand += fileName + "\""; stripCommand += fileName + "\"";
int retVal = 1; int retVal = 1;
std::string output; std::string output;
bool resB = bool resB =
cmSystemTools::RunSingleCommand(stripCommand.c_str(), &output, cmSystemTools::RunSingleCommand(stripCommand.c_str(), &output,
&retVal, 0, &retVal, 0,
this->GeneratorVerbose, 0); this->GeneratorVerbose, 0);
if ( !resB || retVal ) if ( !resB || retVal )
{ {
@ -247,8 +250,11 @@ int cmCPackGenericGenerator::InstallProject()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCPackGenericGenerator::InstallProjectViaInstallCommands(bool movable, const char* tempInstallDirectory) int cmCPackGenericGenerator::InstallProjectViaInstallCommands(
bool movable, const char* tempInstallDirectory)
{ {
(void)movable;
(void)tempInstallDirectory;
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS"); const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
if ( installCommands && *installCommands ) if ( installCommands && *installCommands )
{ {
@ -285,8 +291,11 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCommands(bool movable, cons
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(bool movable, const char* tempInstallDirectory) int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(
bool movable, const char* tempInstallDirectory)
{ {
(void)movable;
(void)tempInstallDirectory;
std::vector<cmsys::RegularExpression> ignoreFilesRegex; std::vector<cmsys::RegularExpression> ignoreFilesRegex;
const char* cpackIgnoreFiles = this->GetOption("CPACK_IGNORE_FILES"); const char* cpackIgnoreFiles = this->GetOption("CPACK_IGNORE_FILES");
if ( cpackIgnoreFiles ) if ( cpackIgnoreFiles )
@ -382,13 +391,14 @@ int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(bool movable,
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(bool movable, const char* tempInstallDirectory) int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(
bool movable, const char* tempInstallDirectory)
{ {
const char* cmakeProjects const char* cmakeProjects
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS"); = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
const char* cmakeGenerator const char* cmakeGenerator
= this->GetOption("CPACK_CMAKE_GENERATOR"); = this->GetOption("CPACK_CMAKE_GENERATOR");
std::string currentWorkingDirectory = std::string currentWorkingDirectory =
cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::GetCurrentWorkingDirectory();
if ( cmakeProjects && *cmakeProjects ) if ( cmakeProjects && *cmakeProjects )
{ {
@ -431,14 +441,14 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(bool movable,
std::string installFile = installDirectory + "/cmake_install.cmake"; std::string installFile = installDirectory + "/cmake_install.cmake";
const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG"); const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG");
cmGlobalGenerator* globalGenerator cmGlobalGenerator* globalGenerator
= this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator( = this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator(
cmakeGenerator); cmakeGenerator);
// set the global flag for unix style paths on cmSystemTools as // set the global flag for unix style paths on cmSystemTools as
// soon as the generator is set. This allows gmake to be used // soon as the generator is set. This allows gmake to be used
// on windows. // on windows.
cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths()); cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths());
// Does this generator require pre-install? // Does this generator require pre-install?
if ( globalGenerator->GetPreinstallTargetName() ) if ( globalGenerator->GetPreinstallTargetName() )
{ {
@ -447,7 +457,7 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(bool movable,
= this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM"); = this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM");
std::string buildCommand std::string buildCommand
= globalGenerator->GenerateBuildCommand(cmakeMakeProgram, = globalGenerator->GenerateBuildCommand(cmakeMakeProgram,
installProjectName.c_str(), 0, installProjectName.c_str(), 0,
globalGenerator->GetPreinstallTargetName(), globalGenerator->GetPreinstallTargetName(),
buildConfig, false, false); buildConfig, false, false);
cmCPackLogger(cmCPackLog::LOG_DEBUG, cmCPackLogger(cmCPackLog::LOG_DEBUG,
@ -456,11 +466,11 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(bool movable,
"- Run preinstall target for: " << installProjectName << std::endl); "- Run preinstall target for: " << installProjectName << std::endl);
std::string output; std::string output;
int retVal = 1; int retVal = 1;
bool resB = bool resB =
cmSystemTools::RunSingleCommand(buildCommand.c_str(), cmSystemTools::RunSingleCommand(buildCommand.c_str(),
&output, &output,
&retVal, &retVal,
installDirectory.c_str(), installDirectory.c_str(),
this->GeneratorVerbose, 0); this->GeneratorVerbose, 0);
if ( !resB || retVal ) if ( !resB || retVal )
{ {
@ -480,7 +490,7 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(bool movable,
} }
} }
delete globalGenerator; delete globalGenerator;
cmCPackLogger(cmCPackLog::LOG_OUTPUT, cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Install project: " << installProjectName << std::endl); "- Install project: " << installProjectName << std::endl);
cmake cm; cmake cm;
@ -507,7 +517,7 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(bool movable,
= cmSystemTools::LowerCase(installComponent); = cmSystemTools::LowerCase(installComponent);
if ( installComponentLowerCase != "all" ) if ( installComponentLowerCase != "all" )
{ {
mf->AddDefinition("CMAKE_INSTALL_COMPONENT", mf->AddDefinition("CMAKE_INSTALL_COMPONENT",
installComponent.c_str()); installComponent.c_str());
} }
@ -559,9 +569,11 @@ int cmCPackGenericGenerator::ProcessGenerator()
{ {
return 0; return 0;
} }
if ( cmSystemTools::IsOn(this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY")) ) if ( cmSystemTools::IsOn(
this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY")) )
{ {
const char* toplevelDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); const char* toplevelDirectory
= this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
if ( cmSystemTools::FileExists(toplevelDirectory) ) if ( cmSystemTools::FileExists(toplevelDirectory) )
{ {
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove toplevel directory: " cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove toplevel directory: "
@ -903,9 +915,9 @@ int cmCPackGenericGenerator::CleanTemporaryDirectory()
const char* tempInstallDirectory const char* tempInstallDirectory
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY"); = this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
if(cmsys::SystemTools::FileExists(tempInstallDirectory)) if(cmsys::SystemTools::FileExists(tempInstallDirectory))
{ {
cmCPackLogger(cmCPackLog::LOG_OUTPUT, cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Clean temporary : " "- Clean temporary : "
<< tempInstallDirectory << std::endl); << tempInstallDirectory << std::endl);
if(!cmsys::SystemTools::RemoveADirectory(tempInstallDirectory)) if(!cmsys::SystemTools::RemoveADirectory(tempInstallDirectory))
{ {