mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
@@ -308,6 +308,11 @@ Format
|
||||
|
||||
Path to the project source directory's parent directory.
|
||||
|
||||
``${sourceDirName}``
|
||||
|
||||
The last filename component of ``${sourceDir}``. For example, if
|
||||
``${sourceDir}`` is ``/path/to/source``, this would be ``source``.
|
||||
|
||||
``${presetName}``
|
||||
|
||||
Name specified in the preset's ``name`` field.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
"TEST_DOLLAR": {
|
||||
"value": "${dollar}"
|
||||
},
|
||||
"TEST_SOURCE_DIR_NAME": "${sourceDirName}",
|
||||
"TEST_ENV_REF": "$env{TEST_ENV_REF}",
|
||||
"TEST_ENV": "$env{TEST_ENV}",
|
||||
"TEST_D_ENV_REF": "$env{TEST_D_ENV_REF}",
|
||||
|
||||
@@ -26,6 +26,7 @@ Preset CMake variables:
|
||||
TEST_PRESET_NAME:STRING="xGoodx"
|
||||
TEST_SOURCE_DIR:PATH="[^
|
||||
]*/Tests/RunCMake/CMakePresets/Good"
|
||||
TEST_SOURCE_DIR_NAME="Good"
|
||||
TEST_SOURCE_LIST:FILEPATH="[^
|
||||
]*/Tests/RunCMake/CMakePresets/Good/CMakeLists\.txt"
|
||||
TEST_SOURCE_PARENT_DIR:PATH="[^
|
||||
|
||||
@@ -17,6 +17,7 @@ test_variable(TEST_UNTYPED_BOOL_FALSE "UNINITIALIZED" "FALSE")
|
||||
test_variable(TEST_PRESET_NAME "STRING" "xGoodx")
|
||||
test_variable(TEST_GENERATOR "UNINITIALIZED" "x${CMAKE_GENERATOR}x")
|
||||
test_variable(TEST_DOLLAR "UNINITIALIZED" "$")
|
||||
test_variable(TEST_SOURCE_DIR_NAME "UNINITIALIZED" "Good")
|
||||
test_variable(TEST_ENV_REF "UNINITIALIZED" "Environment variable")
|
||||
test_variable(TEST_ENV "UNINITIALIZED" "Environment variable")
|
||||
test_variable(TEST_D_ENV_REF "UNINITIALIZED" "xEnvironment variablex")
|
||||
|
||||
Reference in New Issue
Block a user