CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / cmConditionEvaluator.h
blob4f42206d07d06bee9cf7be1368f4ac1900eaedb0
1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #pragma once
5 #include "cmConfigure.h" // IWYU pragma: keep
7 #include <string>
8 #include <vector>
10 #include <cmext/string_view>
12 #include "cmListFileCache.h"
13 #include "cmMessageType.h" // IWYU pragma: keep
14 #include "cmPolicies.h"
15 #include "cmValue.h"
17 class cmExpandedCommandArgument;
18 class cmMakefile;
20 class cmConditionEvaluator
22 public:
23 cmConditionEvaluator(cmMakefile& makefile, cmListFileBacktrace bt);
25 // this is a shared function for both If and Else to determine if the
26 // arguments were valid, and if so, was the response true. If there is
27 // an error, the errorString will be set.
28 bool IsTrue(const std::vector<cmExpandedCommandArgument>& args,
29 std::string& errorString, MessageType& status);
31 private:
32 class cmArgumentList;
34 // Filter the given variable definition based on policy CMP0054.
35 cmValue GetDefinitionIfUnquoted(
36 const cmExpandedCommandArgument& argument) const;
38 cmValue GetVariableOrString(const cmExpandedCommandArgument& argument) const;
40 bool IsKeyword(cm::static_string_view keyword,
41 const cmExpandedCommandArgument& argument) const;
43 bool GetBooleanValue(cmExpandedCommandArgument& arg) const;
45 bool GetBooleanValueOld(cmExpandedCommandArgument const& arg,
46 bool one) const;
48 bool GetBooleanValueWithAutoDereference(cmExpandedCommandArgument& newArg,
49 std::string& errorString,
50 MessageType& status,
51 bool oneArg = false) const;
53 template <int N>
54 int matchKeysImpl(const cmExpandedCommandArgument&);
56 template <int N, typename T, typename... Keys>
57 int matchKeysImpl(const cmExpandedCommandArgument&, T, Keys...);
59 template <typename... Keys>
60 int matchKeys(const cmExpandedCommandArgument&, Keys...);
62 bool HandleLevel0(cmArgumentList& newArgs, std::string& errorString,
63 MessageType& status);
65 bool HandleLevel1(cmArgumentList& newArgs, std::string&, MessageType&);
67 bool HandleLevel2(cmArgumentList& newArgs, std::string& errorString,
68 MessageType& status);
70 bool HandleLevel3(cmArgumentList& newArgs, std::string& errorString,
71 MessageType& status);
73 bool HandleLevel4(cmArgumentList& newArgs, std::string& errorString,
74 MessageType& status);
76 cmMakefile& Makefile;
77 cmListFileBacktrace Backtrace;
78 cmPolicies::PolicyStatus Policy12Status;
79 cmPolicies::PolicyStatus Policy54Status;
80 cmPolicies::PolicyStatus Policy57Status;
81 cmPolicies::PolicyStatus Policy64Status;
82 cmPolicies::PolicyStatus Policy139Status;