diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-01-20 16:04:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-01-20 19:38:12 (GMT) |
commit | eacf1f879b0933509efbd4fb4d6d72ce99412aa7 (patch) | |
tree | a869c4da32763c06491413a5c0b6695b6d0628de /Tests | |
parent | a4f076110d4ceaf92f60a604fbca08f645cb5844 (diff) | |
download | CMake-eacf1f879b0933509efbd4fb4d6d72ce99412aa7.zip CMake-eacf1f879b0933509efbd4fb4d6d72ce99412aa7.tar.gz CMake-eacf1f879b0933509efbd4fb4d6d72ce99412aa7.tar.bz2 |
cmake: Warn about unnecessary paths on command line
We can't make it an error as that would break existing behavior.
Fixes: #23110
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CommandLine/B-S-extra-path-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/S-B-extra-path-stderr.txt | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/B-S-extra-path-stderr.txt b/Tests/RunCMake/CommandLine/B-S-extra-path-stderr.txt new file mode 100644 index 0000000..8794f74 --- /dev/null +++ b/Tests/RunCMake/CommandLine/B-S-extra-path-stderr.txt @@ -0,0 +1,4 @@ +^CMake Warning: + Ignoring extra path from command line: + + /extra/path/$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 313b579..033fbe6 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -143,6 +143,10 @@ endif() run_cmake_with_options(S-arg-build-dir-not-created -S ${source_dir} build/) run_cmake_with_options(S-arg-reverse-build-dir-not-created build/ -S${source_dir} ) + file(REMOVE_RECURSE "${source_dir}/build") + file(MAKE_DIRECTORY "${source_dir}/build") + run_cmake_with_options(S-arg-build-dir-empty -S ${source_dir} build/) + set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs) set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build) @@ -155,6 +159,7 @@ endif() run_cmake_with_options(S-no-arg -S ) run_cmake_with_options(S-no-arg2 -S -T) run_cmake_with_options(S-B -S ${source_dir} -B ${binary_dir}) + run_cmake_with_options(S-B-extra-path -S ${source_dir} -B ${binary_dir} /extra/path/) # make sure that -B can explicitly construct build directories file(REMOVE_RECURSE "${binary_dir}") @@ -165,6 +170,7 @@ endif() run_cmake_with_options(B-no-arg2 -B -T) file(REMOVE_RECURSE "${binary_dir}") run_cmake_with_options(B-S -B${binary_dir} -S${source_dir}) + run_cmake_with_options(B-S-extra-path -B${binary_dir} -S${source_dir} /extra/path/) message("copied to ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt") file(COPY ${RunCMake_SOURCE_DIR}/C_buildsrcdir/initial-cache.txt DESTINATION ${RunCMake_TEST_BINARY_DIR}) diff --git a/Tests/RunCMake/CommandLine/S-B-extra-path-stderr.txt b/Tests/RunCMake/CommandLine/S-B-extra-path-stderr.txt new file mode 100644 index 0000000..8794f74 --- /dev/null +++ b/Tests/RunCMake/CommandLine/S-B-extra-path-stderr.txt @@ -0,0 +1,4 @@ +^CMake Warning: + Ignoring extra path from command line: + + /extra/path/$ |