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
4 
5 #include <string>
6 
7 #include "cmValue.h"
8 
9 class cmMakefile;
10 class cmGeneratorTarget;
11 class cmTarget;
12 
13 class cmStandardLevelResolver
14 {
15 
16 public:
cmStandardLevelResolver(cmMakefile * makefile)17   explicit cmStandardLevelResolver(cmMakefile* makefile)
18     : Makefile(makefile)
19   {
20   }
21 
22   std::string GetCompileOptionDef(cmGeneratorTarget const* target,
23                                   std::string const& lang,
24                                   std::string const& config) const;
25 
26   bool AddRequiredTargetFeature(cmTarget* target, const std::string& feature,
27                                 std::string* error = nullptr) const;
28 
29   bool CompileFeatureKnown(const std::string& targetName,
30                            const std::string& feature, std::string& lang,
31                            std::string* error) const;
32 
33   cmValue CompileFeaturesAvailable(const std::string& lang,
34                                    std::string* error) const;
35 
36   bool GetNewRequiredStandard(const std::string& targetName,
37                               const std::string& feature,
38                               cmValue currentLangStandardValue,
39                               std::string& newRequiredStandard,
40                               std::string* error = nullptr) const;
41 
42   bool HaveStandardAvailable(cmGeneratorTarget const* target,
43                              std::string const& lang,
44                              std::string const& config,
45                              const std::string& feature) const;
46 
47   bool IsLaterStandard(std::string const& lang, std::string const& lhs,
48                        std::string const& rhs) const;
49 
50 private:
51   bool CheckCompileFeaturesAvailable(const std::string& targetName,
52                                      const std::string& feature,
53                                      std::string& lang,
54                                      std::string* error) const;
55 
56   cmMakefile* Makefile;
57 };
58