summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakePresetsFileInternal.h
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-03-19 14:40:03 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2021-03-19 15:30:07 (GMT)
commitce6ea7c927b9f80f219a7783ce725bea4c24091f (patch)
tree1b33c757327dec47d97a5988f209a9b29a961a93 /Source/cmCMakePresetsFileInternal.h
parentebbd475e54e0ce66dbb1b07a129a11b05cdf3dbb (diff)
downloadCMake-ce6ea7c927b9f80f219a7783ce725bea4c24091f.zip
CMake-ce6ea7c927b9f80f219a7783ce725bea4c24091f.tar.gz
CMake-ce6ea7c927b9f80f219a7783ce725bea4c24091f.tar.bz2
Refactor: Move some common code into separate file
This code is going to be needed by both cmCMakePresetsFile and cmCMakePresetsFileReadJSON when the upcoming condition types are created. Move it into a header file.
Diffstat (limited to 'Source/cmCMakePresetsFileInternal.h')
-rw-r--r--Source/cmCMakePresetsFileInternal.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmCMakePresetsFileInternal.h b/Source/cmCMakePresetsFileInternal.h
new file mode 100644
index 0000000..f05b8ce
--- /dev/null
+++ b/Source/cmCMakePresetsFileInternal.h
@@ -0,0 +1,22 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmCMakePresetsFile.h"
+
+#define CHECK_OK(expr) \
+ { \
+ auto _result = expr; \
+ if (_result != ReadFileResult::READ_OK) \
+ return _result; \
+ }
+
+namespace cmCMakePresetsFileInternal {
+enum class ExpandMacroResult
+{
+ Ok,
+ Ignore,
+ Error,
+};
+
+using MacroExpander = std::function<ExpandMacroResult(
+ const std::string&, const std::string&, std::string&, int version)>;
+}