diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 39ade85a53..fbbe50b1ea 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1107,7 +1107,11 @@ void cmake::SetArgs(std::vector 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", diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs-H-arg-stderr.txt b/Tests/RunCMake/CommandLine/ExplicitDirs-H-arg-stderr.txt new file mode 100644 index 0000000000..b428cb3467 --- /dev/null +++ b/Tests/RunCMake/CommandLine/ExplicitDirs-H-arg-stderr.txt @@ -0,0 +1 @@ +^The -H option is deprecated\. Use -S instead\.$ diff --git a/Tests/RunCMake/CommandLine/ExplicitDirs-H-arg-stdout.txt b/Tests/RunCMake/CommandLine/ExplicitDirs-H-arg-stdout.txt new file mode 100644 index 0000000000..618dcd8167 --- /dev/null +++ b/Tests/RunCMake/CommandLine/ExplicitDirs-H-arg-stdout.txt @@ -0,0 +1,2 @@ +-- CMAKE_SOURCE_DIR='[^']*/Tests/RunCMake/CommandLine/ExplicitDirs' +-- CMAKE_BINARY_DIR='[^']*/Tests/RunCMake/CommandLine/ExplicitDirs-build' diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index ad4678ce22..bc5d07fa16 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -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 ""]])