mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
cmake: add dedicated error for -E compare_files invalid arguments
Return 2 when user provides invalid arguments Fixes: #20815
This commit is contained in:
@@ -566,7 +566,8 @@ Available commands are:
|
||||
|
||||
``compare_files [--ignore-eol] <file1> <file2>``
|
||||
Check if ``<file1>`` is same as ``<file2>``. If files are the same,
|
||||
then returns ``0``, if not it returns ``1``. The ``--ignore-eol`` option
|
||||
then returns ``0``, if not it returns ``1``. In case of invalid
|
||||
arguments, it retruns 2. The ``--ignore-eol`` option
|
||||
implies line-wise comparison and ignores LF/CRLF differences.
|
||||
|
||||
``copy <file>... <destination>``
|
||||
|
@@ -582,7 +582,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
||||
filesDiffer = cmsys::SystemTools::TextFilesDiffer(args[3], args[4]);
|
||||
} else {
|
||||
::CMakeCommandUsage(args[0].c_str());
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (filesDiffer) {
|
||||
|
@@ -0,0 +1 @@
|
||||
2
|
@@ -0,0 +1 @@
|
||||
.*
|
@@ -22,6 +22,7 @@ run_cmake_command(E_compare_files-different-eol ${CMAKE_COMMAND} -E compare_file
|
||||
run_cmake_command(E_compare_files-ignore-eol-same ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/lf ${RunCMake_SOURCE_DIR}/compare_files/crlf)
|
||||
run_cmake_command(E_compare_files-ignore-eol-empty ${CMAKE_COMMAND} -E compare_files --ignore-eol ${RunCMake_SOURCE_DIR}/compare_files/empty1 ${RunCMake_SOURCE_DIR}/compare_files/empty2)
|
||||
run_cmake_command(E_compare_files-ignore-eol-nonexistent ${CMAKE_COMMAND} -E compare_files --ignore-eol nonexistent_a nonexistent_b)
|
||||
run_cmake_command(E_compare_files-invalid-arguments ${CMAKE_COMMAND} -E compare_files file1.txt file2.txt file3.txt)
|
||||
run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append)
|
||||
run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename)
|
||||
run_cmake_command(E_server-arg ${CMAKE_COMMAND} -E server --extra-arg)
|
||||
|
Reference in New Issue
Block a user