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

Function HandleReplaceFilenameCommand

Source/cmCMakePathCommand.cxx:333–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333bool HandleReplaceFilenameCommand(std::vector<std::string> const& args,
334 cmExecutionStatus& status)
335{
336 static OutputVariableParser const parser{};
337
338 auto const arguments = parser.Parse(args);
339
340 if (arguments.MaybeReportError(status.GetMakefile())) {
341 return true;
342 }
343
344 if (parser.GetInputs().size() > 1) {
345 status.SetError("REPLACE_FILENAME called with unexpected arguments.");
346 return false;
347 }
348
349 std::string inputPath;
350 if (!getInputPath(args[1], status, inputPath)) {
351 return false;
352 }
353
354 cmCMakePath path(inputPath);
355 path.ReplaceFileName(
356 parser.GetInputs().empty() ? "" : parser.GetInputs().front());
357
358 status.GetMakefile().AddDefinition(
359 arguments.Output ? *arguments.Output : args[1], path.String());
360
361 return true;
362}
363
364bool HandleRemoveExtensionCommand(std::vector<std::string> const& args,
365 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 10

getInputPathFunction · 0.85
MaybeReportErrorMethod · 0.80
ParseMethod · 0.45
GetMakefileMethod · 0.45
sizeMethod · 0.45
SetErrorMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
AddDefinitionMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…