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

Function HandleIsPrefixCommand

Source/cmCMakePathCommand.cxx:842–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842bool HandleIsPrefixCommand(std::vector<std::string> const& args,
843 cmExecutionStatus& status)
844{
845 if (args.size() < 4 || args.size() > 5) {
846 status.SetError("IS_PREFIX must be called with three or four arguments.");
847 return false;
848 }
849
850 static NormalizeParser const parser;
851
852 auto const arguments = parser.Parse(args);
853
854 if (parser.GetInputs().size() != 2) {
855 status.SetError("IS_PREFIX called with unexpected arguments.");
856 return false;
857 }
858
859 std::string inputPath;
860 if (!getInputPath(args[1], status, inputPath)) {
861 return false;
862 }
863
864 auto const& input = parser.GetInputs().front();
865 auto const& output = parser.GetInputs().back();
866
867 if (output.empty()) {
868 status.SetError("Invalid name for output variable.");
869 return false;
870 }
871
872 bool isPrefix;
873 if (arguments.Normalize) {
874 isPrefix =
875 cmCMakePath(inputPath).Normal().IsPrefix(cmCMakePath(input).Normal());
876 } else {
877 isPrefix = cmCMakePath(inputPath).IsPrefix(input);
878 }
879
880 status.GetMakefile().AddDefinitionBool(output, isPrefix);
881
882 return true;
883}
884
885bool HandleHashCommand(std::vector<std::string> const& args,
886 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 12

getInputPathFunction · 0.85
cmCMakePathClass · 0.85
IsPrefixMethod · 0.80
NormalMethod · 0.80
AddDefinitionBoolMethod · 0.80
sizeMethod · 0.45
SetErrorMethod · 0.45
ParseMethod · 0.45
frontMethod · 0.45
backMethod · 0.45
emptyMethod · 0.45
GetMakefileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…