cmake-cli: Deprecate -H

Fixes: #18341
This commit is contained in:
Robert Maynard
2026-09-21 14:35:51 -04:00
committed by Brad King
parent 90e71f4286
commit 00388f8576
4 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -1107,7 +1107,11 @@ void cmake::SetArgs(std::vector<std::string> const& args)
CommandArgument::RequiresSeparator::No, SourceArgLambda },
CommandArgument{ "-H", "No source directory specified for -H",
CommandArgument::Values::One,
CommandArgument::RequiresSeparator::No, SourceArgLambda },
CommandArgument::RequiresSeparator::No,
[&](std::string const& value, cmake* state) -> bool {
warnDeprecated("-H", "-S");
return SourceArgLambda(value, state);
} },
CommandArgument{ "-O", CommandArgument::Values::Zero,
IgnoreAndTrueLambda },
CommandArgument{ "-B", "No build directory specified for -B",
@@ -0,0 +1 @@
^The -H option is deprecated\. Use -S instead\.$
@@ -0,0 +1,2 @@
-- CMAKE_SOURCE_DIR='[^']*/Tests/RunCMake/CommandLine/ExplicitDirs'
-- CMAKE_BINARY_DIR='[^']*/Tests/RunCMake/CommandLine/ExplicitDirs-build'
@@ -273,6 +273,7 @@ message(STATUS "CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}'")
file(REMOVE_RECURSE "${binary_dir}")
run_cmake_with_options(ExplicitDirs-S-arg -S ${source_dir} ${binary_dir})
run_cmake_with_options(ExplicitDirs-S-arg-reverse-order ${binary_dir} -S${source_dir} )
run_cmake_with_options(ExplicitDirs-H-arg -H${source_dir} ${binary_dir})
run_cmake_with_options(ExplicitDirs-S-no-arg -S )
run_cmake_with_options(ExplicitDirs-S-no-arg2 -S -T)
run_cmake_with_raw_args(ExplicitDirs-S-no-arg3 [[-S ""]])