diff options
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 26cebf0..59701a1 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -792,10 +792,22 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent, return; } + std::string stripArgs; + + // macOS 'strip' is picky, executables need '-u -r' and dylibs need '-x'. + if (this->Target->Target->GetMakefile()->IsOn("APPLE")) { + if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY || + this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) { + stripArgs = "-x "; + } else if (this->Target->GetType() == cmStateEnums::EXECUTABLE) { + stripArgs = "-u -r "; + } + } + os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n"; os << indent << " execute_process(COMMAND \"" << this->Target->Target->GetMakefile()->GetDefinition("CMAKE_STRIP") - << "\" \"" << toDestDirPath << "\")\n"; + << "\" " << stripArgs << "\"" << toDestDirPath << "\")\n"; os << indent << "endif()\n"; } |