diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-03-10 21:46:20 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-03-15 18:41:42 (GMT) |
commit | 0d497e159b5854ed050d9eb8c4e965976a03de11 (patch) | |
tree | ea194808ab962ed15d8329ab527d6e2c5472fc7c /Source/cmCMakePresetsFile.cxx | |
parent | 79d03ab5055da1397c525c31d8cb13c30965a911 (diff) | |
download | CMake-0d497e159b5854ed050d9eb8c4e965976a03de11.zip CMake-0d497e159b5854ed050d9eb8c4e965976a03de11.tar.gz CMake-0d497e159b5854ed050d9eb8c4e965976a03de11.tar.bz2 |
CMakePresets.json: Add ${hostSystemName} macro
Diffstat (limited to 'Source/cmCMakePresetsFile.cxx')
-rw-r--r-- | Source/cmCMakePresetsFile.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx index e9caecd..7726927 100644 --- a/Source/cmCMakePresetsFile.cxx +++ b/Source/cmCMakePresetsFile.cxx @@ -9,6 +9,7 @@ #include <iterator> #include <utility> +#include <cm/string_view> #include <cmext/string_view> #include <cm3p/json/reader.h> @@ -981,7 +982,7 @@ bool ExpandMacros(const cmCMakePresetsFile& file, const T& preset, MacroExpander defaultMacroExpander = [&file, &preset](const std::string& macroNamespace, const std::string& macroName, std::string& macroOut, - int /*version*/) -> ExpandMacroResult { + int version) -> ExpandMacroResult { if (macroNamespace.empty()) { if (macroName == "sourceDir") { macroOut += file.SourceDir; @@ -1010,6 +1011,13 @@ bool ExpandMacros(const cmCMakePresetsFile& file, const T& preset, macroOut += '$'; return ExpandMacroResult::Ok; } + if (macroName == "hostSystemName") { + if (version < 3) { + return ExpandMacroResult::Error; + } + macroOut += cmSystemTools::GetSystemName(); + return ExpandMacroResult::Ok; + } } return ExpandMacroResult::Ignore; |