summaryrefslogtreecommitdiffstats
path: root/Source/cmStandardLevelResolver.h
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-06-22 21:11:56 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2020-07-01 11:58:58 (GMT)
commitdc94b0249e1f4057c153bbd6deeea13ad85987e6 (patch)
tree6af9ec6ec603f5f60f5a2222ed9be25c08eda21b /Source/cmStandardLevelResolver.h
parent8975c2a55b2d274b4de46c482c5873c52ba3a358 (diff)
downloadCMake-dc94b0249e1f4057c153bbd6deeea13ad85987e6.zip
CMake-dc94b0249e1f4057c153bbd6deeea13ad85987e6.tar.gz
CMake-dc94b0249e1f4057c153bbd6deeea13ad85987e6.tar.bz2
cmStandardLevelResolver: Added to handle standard level queries
Refactored out of cmMakefile
Diffstat (limited to 'Source/cmStandardLevelResolver.h')
-rw-r--r--Source/cmStandardLevelResolver.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/Source/cmStandardLevelResolver.h b/Source/cmStandardLevelResolver.h
new file mode 100644
index 0000000..666d6d3
--- /dev/null
+++ b/Source/cmStandardLevelResolver.h
@@ -0,0 +1,111 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cmStandardLevelResolver_h
+#define cmStandardLevelResolver_h
+
+#include <string>
+
+#include "cmProperty.h"
+
+class cmMakefile;
+class cmGeneratorTarget;
+class cmTarget;
+
+class cmStandardLevelResolver
+{
+
+public:
+ explicit cmStandardLevelResolver(cmMakefile* makefile)
+ : Makefile(makefile)
+ {
+ }
+
+ bool AddRequiredTargetFeature(cmTarget* target, const std::string& feature,
+ std::string* error = nullptr) const;
+
+ bool CompileFeatureKnown(const std::string& targetName,
+ const std::string& feature, std::string& lang,
+ std::string* error) const;
+
+ const char* CompileFeaturesAvailable(const std::string& lang,
+ std::string* error) const;
+
+ bool GetNewRequiredStandard(const std::string& targetName,
+ const std::string& feature,
+ cmProp currentLangStandardValue,
+ std::string& newRequiredStandard,
+ std::string* error = nullptr) const;
+
+ bool HaveStandardAvailable(cmGeneratorTarget const* target,
+ std::string const& lang,
+ std::string const& config,
+ const std::string& feature) const;
+
+ bool IsLaterStandard(std::string const& lang, std::string const& lhs,
+ std::string const& rhs) const;
+
+private:
+ bool AddRequiredTargetCFeature(cmTarget* target, const std::string& feature,
+ std::string const& lang,
+ std::string* error = nullptr) const;
+ bool AddRequiredTargetCxxFeature(cmTarget* target,
+ const std::string& feature,
+ std::string const& lang,
+ std::string* error = nullptr) const;
+ bool AddRequiredTargetCudaFeature(cmTarget* target,
+ const std::string& feature,
+ std::string const& lang,
+ std::string* error = nullptr) const;
+
+ bool CheckCompileFeaturesAvailable(const std::string& targetName,
+ const std::string& feature,
+ std::string& lang,
+ std::string* error) const;
+
+ void CheckNeededCLanguage(const std::string& feature,
+ std::string const& lang, bool& needC90,
+ bool& needC99, bool& needC11) const;
+ void CheckNeededCxxLanguage(const std::string& feature,
+ std::string const& lang, bool& needCxx98,
+ bool& needCxx11, bool& needCxx14,
+ bool& needCxx17, bool& needCxx20) const;
+ void CheckNeededCudaLanguage(const std::string& feature,
+ std::string const& lang, bool& needCuda03,
+ bool& needCuda11, bool& needCuda14,
+ bool& needCuda17, bool& needCuda20) const;
+
+ bool GetNewRequiredCStandard(const std::string& targetName,
+ const std::string& feature,
+ std::string const& lang,
+ cmProp currentLangStandardValue,
+ std::string& newRequiredStandard,
+ std::string* error = nullptr) const;
+ bool GetNewRequiredCxxStandard(const std::string& targetName,
+ const std::string& feature,
+ std::string const& lang,
+ cmProp currentLangStandardValue,
+ std::string& newRequiredStandard,
+ std::string* error = nullptr) const;
+ bool GetNewRequiredCudaStandard(const std::string& targetName,
+ const std::string& feature,
+ std::string const& lang,
+ cmProp currentLangStandardValue,
+ std::string& newRequiredStandard,
+ std::string* error = nullptr) const;
+
+ bool HaveCStandardAvailable(cmGeneratorTarget const* target,
+ std::string const& lang,
+ std::string const& config,
+ const std::string& feature) const;
+ bool HaveCxxStandardAvailable(cmGeneratorTarget const* target,
+ std::string const& lang,
+ std::string const& config,
+ const std::string& feature) const;
+ bool HaveCudaStandardAvailable(cmGeneratorTarget const* target,
+ std::string const& lang,
+ std::string const& config,
+ const std::string& feature) const;
+
+ cmMakefile* Makefile;
+};
+#endif