summaryrefslogtreecommitdiffstats
path: root/Source/cmake.h
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-09-29 14:17:10 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-10-05 13:49:59 (GMT)
commit8617479061039e2b357b7efc922f1b88648dce42 (patch)
tree41d37c685e178b73cf5122b5741fdcf9e4898d06 /Source/cmake.h
parent06128cf94964697279970a80ddfc1ce2ef7b4da5 (diff)
downloadCMake-8617479061039e2b357b7efc922f1b88648dce42.zip
CMake-8617479061039e2b357b7efc922f1b88648dce42.tar.gz
CMake-8617479061039e2b357b7efc922f1b88648dce42.tar.bz2
CMake: Add presets functionality
Diffstat (limited to 'Source/cmake.h')
-rw-r--r--Source/cmake.h54
1 files changed, 48 insertions, 6 deletions
diff --git a/Source/cmake.h b/Source/cmake.h
index 525af32..262d673 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -27,7 +27,11 @@
#include "cmStateTypes.h"
#if !defined(CMAKE_BOOTSTRAP)
+# include <cm/optional>
+
# include <cm3p/json/value.h>
+
+# include "cmCMakePresetsFile.h"
#endif
class cmExternalMakefileProjectGeneratorFactory;
@@ -88,13 +92,22 @@ public:
enum WorkingMode
{
NORMAL_MODE, ///< Cmake runs to create project files
- /** \brief Script mode (started by using -P).
- *
- * In script mode there is no generator and no cache. Also,
- * languages are not enabled, so add_executable and things do
- * nothing.
- */
+
+ /** \brief Script mode (started by using -P).
+ *
+ * In script mode there is no generator and no cache. Also,
+ * languages are not enabled, so add_executable and things do
+ * nothing.
+ */
SCRIPT_MODE,
+
+ /** \brief Help mode
+ *
+ * Used to print help for things that can only be determined after finding
+ * the source directory, for example, the list of presets.
+ */
+ HELP_MODE,
+
/** \brief A pkg-config like mode
*
* In this mode cmake just searches for a package and prints the results to
@@ -221,6 +234,14 @@ public:
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
const std::string& name, bool allowArch = true);
+ //! Create a GlobalGenerator and set it as our own
+ bool CreateAndSetGlobalGenerator(const std::string& name, bool allowArch);
+
+#ifndef CMAKE_BOOTSTRAP
+ //! Print list of presets
+ void PrintPresetList(const cmCMakePresetsFile& file) const;
+#endif
+
//! Return the global generator assigned to this instance of cmake
cmGlobalGenerator* GetGlobalGenerator()
{
@@ -329,9 +350,22 @@ public:
bool GetIsInTryCompile() const;
void SetIsInTryCompile(bool b);
+#ifndef CMAKE_BOOTSTRAP
+ void SetWarningFromPreset(const std::string& name,
+ const cm::optional<bool>& warning,
+ const cm::optional<bool>& error);
+ void ProcessPresetVariables();
+ void PrintPresetVariables();
+ void ProcessPresetEnvironment();
+ void PrintPresetEnvironment();
+#endif
+
//! Parse command line arguments that might set cache values
bool SetCacheArgs(const std::vector<std::string>&);
+ void ProcessCacheArg(const std::string& var, const std::string& value,
+ cmStateEnums::CacheEntryType type);
+
using ProgressCallbackType = std::function<void(const std::string&, float)>;
/**
* Set the function used by GUIs to receive progress updates
@@ -625,6 +659,12 @@ private:
std::unique_ptr<cmFileTimeCache> FileTimeCache;
std::string GraphVizFile;
InstalledFilesMap InstalledFiles;
+#ifndef CMAKE_BOOTSTRAP
+ std::map<std::string, cm::optional<cmCMakePresetsFile::CacheVariable>>
+ UnprocessedPresetVariables;
+ std::map<std::string, cm::optional<std::string>>
+ UnprocessedPresetEnvironment;
+#endif
#if !defined(CMAKE_BOOTSTRAP)
std::unique_ptr<cmVariableWatch> VariableWatch;
@@ -664,6 +704,8 @@ private:
#define CMAKE_STANDARD_OPTIONS_TABLE \
{ "-S <path-to-source>", "Explicitly specify a source directory." }, \
{ "-B <path-to-build>", "Explicitly specify a build directory." }, \
+ { "--preset=<preset-name>", "Explicitly specify a preset." }, \
+ { "--list-presets", "List available presets." }, \
{ "-C <initial-cache>", "Pre-load a script to populate the cache." }, \
{ "-D <var>[:<type>]=<value>", "Create or update a cmake cache entry." }, \
{ "-U <globbing_expr>", "Remove matching entries from CMake cache." }, \