summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakePresetsFile.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-10-16 19:31:01 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-10-22 15:09:28 (GMT)
commit25742c589c80724b1d03357e0c911c443ab991f4 (patch)
tree7412e73ffa82a88e7beb9cc01fe7a638a5363444 /Source/cmCMakePresetsFile.cxx
parent609122007dc074739b394d2f70f674bbccca6073 (diff)
downloadCMake-25742c589c80724b1d03357e0c911c443ab991f4.zip
CMake-25742c589c80724b1d03357e0c911c443ab991f4.tar.gz
CMake-25742c589c80724b1d03357e0c911c443ab991f4.tar.bz2
CMakePresets.json: Add ${sourceDirName} macro
Fixes: #21312
Diffstat (limited to 'Source/cmCMakePresetsFile.cxx')
-rw-r--r--Source/cmCMakePresetsFile.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx
index b3bb6df..69bae7f 100644
--- a/Source/cmCMakePresetsFile.cxx
+++ b/Source/cmCMakePresetsFile.cxx
@@ -638,6 +638,10 @@ ExpandMacroResult ExpandMacro(const cmCMakePresetsFile& file,
out += cmSystemTools::GetParentDirectory(file.SourceDir);
return ExpandMacroResult::Ok;
}
+ if (macroName == "sourceDirName") {
+ out += cmSystemTools::GetFilenameName(file.SourceDir);
+ return ExpandMacroResult::Ok;
+ }
if (macroName == "presetName") {
out += preset.Name;
return ExpandMacroResult::Ok;