| 4049 | } |
| 4050 | |
| 4051 | cmGlobalGenerator::StripCommandStyle cmGlobalGenerator::GetStripCommandStyle( |
| 4052 | std::string const& strip) |
| 4053 | { |
| 4054 | #ifdef __APPLE__ |
| 4055 | auto i = this->StripCommandStyleMap.find(strip); |
| 4056 | if (i == this->StripCommandStyleMap.end()) { |
| 4057 | StripCommandStyle style = StripCommandStyle::Default; |
| 4058 | |
| 4059 | // Try running strip tool with Apple-specific options. |
| 4060 | std::vector<std::string> cmd{ strip, "-u", "-r" }; |
| 4061 | std::string out; |
| 4062 | std::string err; |
| 4063 | int ret; |
| 4064 | if (cmSystemTools::RunSingleCommand(cmd, &out, &err, &ret, nullptr, |
| 4065 | cmSystemTools::OUTPUT_NONE) && |
| 4066 | // Check for Apple-specific output. |
| 4067 | ret != 0 && cmHasLiteralPrefix(err, "fatal error: /") && |
| 4068 | err.find("/usr/bin/strip: no files specified") != std::string::npos) { |
| 4069 | style = StripCommandStyle::Apple; |
| 4070 | } |
| 4071 | i = this->StripCommandStyleMap.emplace(strip, style).first; |
| 4072 | } |
| 4073 | return i->second; |
| 4074 | #else |
| 4075 | static_cast<void>(strip); |
| 4076 | return StripCommandStyle::Default; |
| 4077 | #endif |
| 4078 | } |
| 4079 | |
| 4080 | std::string cmGlobalGenerator::GetEncodedLiteral(std::string const& lit) |
| 4081 | { |
no test coverage detected