summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-06-15 15:12:07 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-06-15 15:12:07 (GMT)
commit69d362846161e14002377a66e7505219b2b6af27 (patch)
treebfd2b871ed84bf80c09ae4675890481f271198f4
parentfe45c1966677ef8807f36d586159e7e74934b1db (diff)
downloadCMake-69d362846161e14002377a66e7505219b2b6af27.zip
CMake-69d362846161e14002377a66e7505219b2b6af27.tar.gz
CMake-69d362846161e14002377a66e7505219b2b6af27.tar.bz2
BUG: don't run strip on OPTIONAL install targets if the file doesn't exist
Alex
-rw-r--r--Source/cmInstallTargetGenerator.cxx43
-rw-r--r--Source/cmInstallTargetGenerator.h9
2 files changed, 34 insertions, 18 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 45e715f..c38bcc7 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -177,13 +177,15 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
this->AddInstallNamePatchRule(os, destination.c_str());
}
- std::string destinationFilename = destination;
- destinationFilename += "/";
- destinationFilename += cmSystemTools::GetFilenameName(fromFile);
-
- this->AddRanlibRule(os, type, destinationFilename);
+ std::string quotedFullDestinationFilename = "\"$ENV{DESTDIR}";
+ quotedFullDestinationFilename += destination;
+ quotedFullDestinationFilename += "/";
+ quotedFullDestinationFilename += cmSystemTools::GetFilenameName(fromFile);
+ quotedFullDestinationFilename += "\"";
+
+ this->AddRanlibRule(os, type, quotedFullDestinationFilename);
- this->AddStripRule(os, destinationFilename);
+ this->AddStripRule(os, quotedFullDestinationFilename, optional);
}
//----------------------------------------------------------------------------
@@ -451,7 +453,8 @@ void cmInstallTargetGenerator
}
void cmInstallTargetGenerator::AddStripRule(std::ostream& os,
- const std::string& destinationFilename)
+ const std::string& quotedFullDestinationFilename,
+ bool optional)
{
// Don't handle OSX Bundles.
@@ -466,16 +469,26 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os,
return;
}
- os << "IF(CMAKE_INSTALL_DO_STRIP)\n";
- os << " EXECUTE_PROCESS(COMMAND \"";
- os << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP");
- os << "\" \"$ENV{DESTDIR}" << destinationFilename << "\" )\n";
- os << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n";
+ os << "IF(CMAKE_INSTALL_DO_STRIP";
+ if (optional)
+ {
+ os << " AND EXISTS " << quotedFullDestinationFilename;
+ }
+ os << ")\n";
+ os << " EXECUTE_PROCESS(COMMAND \""
+ << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
+ << "\" " << quotedFullDestinationFilename << " )\n";
+ os << "ENDIF(CMAKE_INSTALL_DO_STRIP";
+ if (optional)
+ {
+ os << " AND EXISTS " << quotedFullDestinationFilename;
+ }
+ os << ")\n";
}
void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
- cmTarget::TargetType type,
- const std::string& destinationFilename)
+ cmTarget::TargetType type,
+ const std::string& quotedFullDestinationFilename)
{
// Static libraries need ranlib on this platform.
if(type != cmTarget::STATIC_LIBRARY)
@@ -499,5 +512,5 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
os << "EXECUTE_PROCESS(COMMAND \"";
os << ranlib;
- os << "\" \"$ENV{DESTDIR}" << destinationFilename << "\" )\n";
+ os << "\" " << quotedFullDestinationFilename << " )\n";
}
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index c7dcec5..6a84387 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -44,9 +44,12 @@ protected:
std::string GetScriptReference(cmTarget* target, const char* place,
bool useSOName);
void AddInstallNamePatchRule(std::ostream& os, const char* destination);
- void AddStripRule(std::ostream& os, const std::string& destinationFilename);
- void AddRanlibRule(std::ostream& os, cmTarget::TargetType type,
- const std::string& destinationFilename);
+ void AddStripRule(std::ostream& os,
+ const std::string& quotedFullDestinationFilename,
+ bool optional);
+ void AddRanlibRule(std::ostream& os,
+ cmTarget::TargetType type,
+ const std::string& quotedFullDestinationFilename);
cmTarget* Target;
std::string Destination;