summaryrefslogtreecommitdiff
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0e9f78e4d3..08022b3a49 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -3542,3 +3542,32 @@ cmInstallRuntimeDependencySet* cmGlobalGenerator::GetNamedRuntimeDependencySet(
}
return it->second;
}
+
+cmGlobalGenerator::StripCommandStyle cmGlobalGenerator::GetStripCommandStyle(
+ std::string const& strip)
+{
+#ifdef __APPLE__
+ auto i = this->StripCommandStyleMap.find(strip);
+ if (i == this->StripCommandStyleMap.end()) {
+ StripCommandStyle style = StripCommandStyle::Default;
+
+ // Try running strip tool with Apple-specific options.
+ std::vector<std::string> cmd{ strip, "-u", "-r" };
+ std::string out;
+ std::string err;
+ int ret;
+ if (cmSystemTools::RunSingleCommand(cmd, &out, &err, &ret, nullptr,
+ cmSystemTools::OUTPUT_NONE) &&
+ // Check for Apple-specific output.
+ ret != 0 && cmHasLiteralPrefix(err, "fatal error: /") &&
+ err.find("/usr/bin/strip: no files specified") != std::string::npos) {
+ style = StripCommandStyle::Apple;
+ }
+ i = this->StripCommandStyleMap.emplace(strip, style).first;
+ }
+ return i->second;
+#else
+ static_cast<void>(strip);
+ return StripCommandStyle::Default;
+#endif
+}