From 9670a8c485084478ac496df985314755a0f0d80f Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Fri, 18 May 2007 14:41:09 -0400 Subject: ENH: 2nd try to move stripping out of cpack and to install time, now if CPACK_STRIP_FILES is true (or contains a list of files), everything will be stripped, if it's empty or false they won't be stripped Alex --- Source/CPack/bills-comments.txt | 2 +- Source/CPack/cmCPackGenericGenerator.cxx | 53 +++++--------------------------- 2 files changed, 8 insertions(+), 47 deletions(-) diff --git a/Source/CPack/bills-comments.txt b/Source/CPack/bills-comments.txt index 13cb6ab..f73499d 100644 --- a/Source/CPack/bills-comments.txt +++ b/Source/CPack/bills-comments.txt @@ -45,7 +45,7 @@ InstallProject - set CMAKE_INSTALL_PREFIX to the temp directory - CPACK_BUILD_CONFIG check this and set the BUILD_TYPE to it - ReadListFile on the install script cmake_install.cmake - - run strip on the files in this var: CPACK_STRIP_FILES + - run strip on the executables and libraries if CPACK_STRIP_FILES is TRUE Recommendations: diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index a491064..0a19921 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -135,12 +135,6 @@ int cmCPackGenericGenerator::PrepareNames() return 0; } - std::vector path; - std::string pkgPath = cmSystemTools::FindProgram("strip", path, false); - if ( !pkgPath.empty() ) - { - this->SetOptionIfNotSet("CPACK_STRIP_COMMAND", pkgPath.c_str()); - } this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1"); return 1; @@ -218,46 +212,6 @@ int cmCPackGenericGenerator::InstallProject() cmSystemTools::PutEnv("DESTDIR="); } - const char* stripExecutable = this->GetOption("CPACK_STRIP_COMMAND"); - const char* stripFiles - = this->GetOption("CPACK_STRIP_FILES"); - if ( stripFiles && *stripFiles && stripExecutable && *stripExecutable ) - { - cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Strip files" << std::endl); - std::vector stripFilesVector; - cmSystemTools::ExpandListArgument(stripFiles, - stripFilesVector); - std::vector::iterator it; - for ( it = stripFilesVector.begin(); - it != stripFilesVector.end(); - ++it ) - { - std::string fileName = tempInstallDirectory; - fileName += "/" + *it; - fileName += cmSystemTools::GetExecutableExtension(); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, - " Strip file: " << fileName.c_str() - << std::endl); - std::string stripCommand = stripExecutable; - stripCommand += " \""; - stripCommand += fileName + "\""; - int retVal = 1; - std::string output; - bool resB = - cmSystemTools::RunSingleCommand(stripCommand.c_str(), &output, - &retVal, 0, - this->GeneratorVerbose, 0); - if ( !resB || retVal ) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " << stripCommand.c_str() - << std::endl - << "Error was: \"" << output.c_str() << "\"" - << std::endl); - return 0; - } - } - } return res; } @@ -579,6 +533,13 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects( installComponent.c_str()); } + // strip on TRUE, ON, 1, one or several file names, but not on + // FALSE, OFF, 0 and an empty string + if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) + { + mf->AddDefinition("CMAKE_INSTALL_DO_STRIP", "1"); + } + int res = mf->ReadListFile(0, installFile.c_str()); if ( cmSystemTools::GetErrorOccuredFlag() || !res ) { -- cgit v0.12