Commit 29368abd authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'install-strip-macos'

20291e8e

 install: Fix stripping on macOS
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !2892
parents 1b46f2f1 20291e8e
......@@ -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";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment