MCPcopy Create free account
hub / github.com/Kitware/CMake / EscapeForShell

Method EscapeForShell

Source/cmOutputConverter.cxx:242–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242std::string cmOutputConverter::EscapeForShell(cm::string_view str,
243 bool makeVars, bool forEcho,
244 bool useWatcomQuote,
245 bool unescapeNinjaConfiguration,
246 bool forResponse) const
247{
248 // Compute the flags for the target shell environment.
249 int flags = 0;
250 if (this->GetState()->UseWindowsVSIDE()) {
251 flags |= Shell_Flag_VSIDE;
252 } else if (!this->LinkScriptShell) {
253 flags |= Shell_Flag_Make;
254 }
255 if (unescapeNinjaConfiguration) {
256 flags |= Shell_Flag_UnescapeNinjaConfiguration;
257 }
258 if (makeVars) {
259 flags |= Shell_Flag_AllowMakeVariables;
260 }
261 if (forEcho) {
262 flags |= Shell_Flag_EchoWindows;
263 }
264 if (useWatcomQuote) {
265 flags |= Shell_Flag_WatcomQuote;
266 }
267 if (forResponse) {
268 flags |= Shell_Flag_IsResponse;
269 }
270 if (this->GetState()->UseWatcomWMake()) {
271 flags |= Shell_Flag_WatcomWMake;
272 }
273 if (this->GetState()->UseMinGWMake()) {
274 flags |= Shell_Flag_MinGWMake;
275 }
276 if (this->GetState()->UseNMake()) {
277 flags |= Shell_Flag_NMake;
278 }
279 if (this->GetState()->UseNinja()) {
280 flags |= Shell_Flag_Ninja;
281 }
282 if (!this->GetState()->UseWindowsShell()) {
283 flags |= Shell_Flag_IsUnix;
284 }
285 if (this->GetState()->UseFastbuildMake()) {
286 // Fastbuild needs to escape very few characters.
287 flags = Shell_Flag_Fastbuild;
288 }
289
290 return cmOutputConverter::EscapeForShell(str, flags);
291}
292
293std::string cmOutputConverter::EscapeForShell(cm::string_view str, int flags)
294{

Callers 15

ConvertToOutputFormatMethod · 0.95
AppendFlagEscapeMethod · 0.80
WriteExecutableRuleMethod · 0.80
WriteObjectRuleFilesMethod · 0.80
AppendEchoMethod · 0.80
GetRecursiveMakeCallMethod · 0.80
ComputeRPathMethod · 0.80
ComputeLinkLibrariesMethod · 0.80
cmLocalGeneratorMethod · 0.80

Calls 9

GetStateMethod · 0.95
UseWindowsVSIDEMethod · 0.80
UseWatcomWMakeMethod · 0.80
UseMinGWMakeMethod · 0.80
UseNMakeMethod · 0.80
UseNinjaMethod · 0.80
UseWindowsShellMethod · 0.80
UseFastbuildMakeMethod · 0.80

Tested by

no test coverage detected