diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-02-17 13:46:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-02-17 21:54:30 (GMT) |
commit | 7083b1949801dcab8b76cd3978261aca7be30c0e (patch) | |
tree | bc30fcc51660f49bca38b1cef47a1fa4d3c938f2 /Tests/RunCMake/CommandLine/RunCMakeTest.cmake | |
parent | 9c81f2cb8bcb5f4ad96f2ad527035649bd70d5fc (diff) | |
download | CMake-7083b1949801dcab8b76cd3978261aca7be30c0e.zip CMake-7083b1949801dcab8b76cd3978261aca7be30c0e.tar.gz CMake-7083b1949801dcab8b76cd3978261aca7be30c0e.tar.bz2 |
cmake: When given multiple source paths use last instead of first
When given two source paths via `-S` or just directory paths prefer
the last one. When the paths are mixed always prefer the last `-S`
entry.
Fixes: #23238
Diffstat (limited to 'Tests/RunCMake/CommandLine/RunCMakeTest.cmake')
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 5944d2d..17adefd 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -168,6 +168,18 @@ endif() run_cmake_with_raw_args(S-B-non-path "-S \"${source_dir}\" -B \"${binary_dir}\" \"\"") run_cmake_with_raw_args(S-B-non-path2 "-S \"${source_dir}\" \"\" -B \"${binary_dir}\"") + file(REMOVE_RECURSE "${binary_dir}/other_dir") + file(MAKE_DIRECTORY "${binary_dir}/other_dir") + file(WRITE "${binary_dir}/other_dir/CMakeLists.txt" [=[ ]=]) + run_cmake_with_options(S-S-same -S ${source_dir} -S ${source_dir} -B ${binary_dir}) + run_cmake_with_options(S-S-differs -S ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir}) + run_cmake_with_options(S-implicit-same -S ${source_dir} ${source_dir} -B ${binary_dir}) + run_cmake_with_options(S-implicit-differs -S ${source_dir} ${binary_dir}/other_dir -B ${binary_dir}) + run_cmake_with_options(S-implicit-differs2 ${binary_dir}/other_dir -S ${source_dir} -B ${binary_dir}) + run_cmake_with_options(S-implicit-differs3 ${binary_dir}/other_dir ${source_dir} -B ${binary_dir}) + run_cmake_with_options(S-S-Sdiffers -S ${binary_dir}/other_dir1 -S ${binary_dir}/other_dir2 -S ${source_dir} -B ${binary_dir}) + run_cmake_with_options(S-S-Simplicit ${binary_dir}/other_dir1 ${binary_dir}/other_dir2 ${source_dir} -B ${binary_dir}) + # make sure that -B can explicitly construct build directories file(REMOVE_RECURSE "${binary_dir}") run_cmake_with_options(B-arg -B ${binary_dir} ${source_dir}) |