diff --git a/Source/CPack/bills-comments.txt b/Source/CPack/bills-comments.txt index 13cb6abcd..f73499d01 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 a491064ec..0a19921f2 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 ) {