summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakePresetsGraph.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-03-07 22:48:18 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-03-07 23:03:16 (GMT)
commitf54507c2f6826e9b2b021dbf3b3fa75dcdce22fe (patch)
tree017a3aebc0cb87ac32482c0f8c0cff70928baa75 /Source/cmCMakePresetsGraph.cxx
parent7a8536e0eab97d5467dbcca9b14f1a9deaf934ae (diff)
downloadCMake-f54507c2f6826e9b2b021dbf3b3fa75dcdce22fe.zip
CMake-f54507c2f6826e9b2b021dbf3b3fa75dcdce22fe.tar.gz
CMake-f54507c2f6826e9b2b021dbf3b3fa75dcdce22fe.tar.bz2
CMakePresets.json: Add ${fileDir} macro
Fixes: #23214
Diffstat (limited to 'Source/cmCMakePresetsGraph.cxx')
-rw-r--r--Source/cmCMakePresetsGraph.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx
index 705e2b0..dc14831 100644
--- a/Source/cmCMakePresetsGraph.cxx
+++ b/Source/cmCMakePresetsGraph.cxx
@@ -353,6 +353,14 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, const T& preset,
macroOut += cmSystemTools::GetSystemName();
return ExpandMacroResult::Ok;
}
+ if (macroName == "fileDir") {
+ if (version < 4) {
+ return ExpandMacroResult::Error;
+ }
+ macroOut +=
+ cmSystemTools::GetParentDirectory(preset.OriginFile->Filename);
+ return ExpandMacroResult::Ok;
+ }
}
return ExpandMacroResult::Ignore;