summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakePresetsFile.cxx
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2021-04-26 15:51:27 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2021-04-28 21:22:25 (GMT)
commita9b968bb9894902e2183a4aea4c23701d5666733 (patch)
treeb41ad0388074d1ea666f0e210e69ec389f3d2ff7 /Source/cmCMakePresetsFile.cxx
parent0eb42defc222372b660983ac46ea1266543af7e0 (diff)
downloadCMake-a9b968bb9894902e2183a4aea4c23701d5666733.zip
CMake-a9b968bb9894902e2183a4aea4c23701d5666733.tar.gz
CMake-a9b968bb9894902e2183a4aea4c23701d5666733.tar.bz2
cmake-presets: Introduce `toolchainFile` preset option
In v3 of the presets, the `--toolchain` command line argument now has a preset mapping.
Diffstat (limited to 'Source/cmCMakePresetsFile.cxx')
-rw-r--r--Source/cmCMakePresetsFile.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx
index 39cce98..2f9972c 100644
--- a/Source/cmCMakePresetsFile.cxx
+++ b/Source/cmCMakePresetsFile.cxx
@@ -214,6 +214,12 @@ bool ExpandMacros(const cmCMakePresetsFile& file,
cmSystemTools::ConvertToUnixSlashes(out->InstallDir);
}
+ if (!preset.ToolchainFile.empty()) {
+ std::string toolchain = preset.ToolchainFile;
+ CHECK_EXPAND(out, toolchain, macroExpanders, file.GetVersion(preset))
+ out->ToolchainFile = toolchain;
+ }
+
for (auto& variable : out->CacheVariables) {
if (variable.second) {
CHECK_EXPAND(out, variable.second->Value, macroExpanders,
@@ -643,6 +649,7 @@ cmCMakePresetsFile::ConfigurePreset::VisitPresetInherit(
}
InheritString(preset.BinaryDir, parent.BinaryDir);
InheritString(preset.InstallDir, parent.InstallDir);
+ InheritString(preset.ToolchainFile, parent.ToolchainFile);
InheritOptionalValue(preset.WarnDev, parent.WarnDev);
InheritOptionalValue(preset.ErrorDev, parent.ErrorDev);
InheritOptionalValue(preset.WarnDeprecated, parent.WarnDeprecated);
@@ -989,6 +996,9 @@ const char* cmCMakePresetsFile::ResultToString(ReadFileResult result)
return "Invalid preset condition";
case ReadFileResult::CONDITION_UNSUPPORTED:
return "File version must be 3 or higher for condition support";
+ case ReadFileResult::TOOLCHAIN_FILE_UNSUPPORTED:
+ return "File version must be 3 or higher for toolchainFile preset "
+ "support.";
}
return "Unknown error";