From df8f550029dc35ccbf39daf2733dbe2ca79e3d79 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Fri, 18 May 2007 13:43:39 -0400 Subject: [PATCH] ENH: add install/strip target for makefile generators if strip was found Alex --- Source/cmGlobalGenerator.cxx | 23 +++++++++++++++++++++-- Source/cmGlobalGenerator.h | 1 + Source/cmGlobalUnixMakefileGenerator3.h | 1 + Source/cmLocalUnixMakefileGenerator3.cxx | 4 +++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6273f15b3..94cbf3619 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1440,16 +1440,35 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) // install_local if(const char* install_local = this->GetInstallLocalTargetName()) { - singleLine.insert(singleLine.begin()+1, "-DCMAKE_INSTALL_LOCAL_ONLY=1"); + cmCustomCommandLine localCmdLine = singleLine; + + localCmdLine.insert(localCmdLine.begin()+1, "-DCMAKE_INSTALL_LOCAL_ONLY=1"); cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); - cpackCommandLines.push_back(singleLine); + cpackCommandLines.push_back(localCmdLine); (*targets)[install_local] = this->CreateGlobalTarget( install_local, "Installing only the local directory...", &cpackCommandLines, depends); } + + // install_strip + const char* install_strip = this->GetInstallStripTargetName(); + if((install_strip !=0) && (mf->IsSet("CMAKE_STRIP"))) + { + cmCustomCommandLine stripCmdLine = singleLine; + + stripCmdLine.insert(stripCmdLine.begin()+1,"-DCMAKE_INSTALL_DO_STRIP=1"); + cpackCommandLines.erase(cpackCommandLines.begin(), + cpackCommandLines.end()); + cpackCommandLines.push_back(stripCmdLine); + + (*targets)[install_strip] = + this->CreateGlobalTarget( + install_strip, "Installing the project stripped...", + &cpackCommandLines, depends); + } } } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 65fe7159e..15903c42b 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -186,6 +186,7 @@ public: virtual const char* GetAllTargetName() { return "ALL_BUILD"; } virtual const char* GetInstallTargetName() { return "INSTALL"; } virtual const char* GetInstallLocalTargetName() { return 0; } + virtual const char* GetInstallStripTargetName() { return 0; } virtual const char* GetPreinstallTargetName() { return 0; } virtual const char* GetTestTargetName() { return "RUN_TESTS"; } virtual const char* GetPackageTargetName() { return "PACKAGE"; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 5d4ceef2c..5c20b3d40 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -161,6 +161,7 @@ protected: virtual const char* GetAllTargetName() { return "all"; } virtual const char* GetInstallTargetName() { return "install"; } virtual const char* GetInstallLocalTargetName() { return "install/local"; } + virtual const char* GetInstallStripTargetName() { return "install/strip"; } virtual const char* GetPreinstallTargetName() { return "preinstall"; } virtual const char* GetTestTargetName() { return "test"; } virtual const char* GetPackageTargetName() { return "package"; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 425997bc9..252314e46 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1456,7 +1456,9 @@ void cmLocalUnixMakefileGenerator3 // Provide a "/fast" version of the target. depends.clear(); - if((targetName == "install") || (targetName == "install_local")) + if((targetName == "install") + || (targetName == "install_local") + || (targetName == "install_strip")) { // Provide a fast install target that does not depend on all // but has the same command.