| 840 | } |
| 841 | |
| 842 | bool 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 | |
| 885 | bool HandleHashCommand(std::vector<std::string> const& args, |
| 886 | cmExecutionStatus& status) |
nothing calls this directly
no test coverage detected
searching dependent graphs…