summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-05-18 18:41:09 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-05-18 18:41:09 (GMT)
commit9670a8c485084478ac496df985314755a0f0d80f (patch)
treee2293178e103208878239646e3f315a662209386
parentdf8f550029dc35ccbf39daf2733dbe2ca79e3d79 (diff)
downloadCMake-9670a8c485084478ac496df985314755a0f0d80f.zip
CMake-9670a8c485084478ac496df985314755a0f0d80f.tar.gz
CMake-9670a8c485084478ac496df985314755a0f0d80f.tar.bz2
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
-rw-r--r--Source/CPack/bills-comments.txt2
-rw-r--r--Source/CPack/cmCPackGenericGenerator.cxx53
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<std::string> 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<std::string> stripFilesVector;
- cmSystemTools::ExpandListArgument(stripFiles,
- stripFilesVector);
- std::vector<std::string>::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 )
{