file(DOWNLOAD|UPLOAD): Warn on unexpected arguments
Emit warning message on unparsed argument instead of silently ignoring it. Can't stop with the error message because it may break old code.
This commit is contained in:
parent
d5e4cdc0f8
commit
4dd997da54
|
@ -2564,6 +2564,11 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
|
|||
return false;
|
||||
}
|
||||
hashMatchMSG = algo + " hash";
|
||||
} else {
|
||||
// Do not return error for compatibility reason.
|
||||
std::string err = "Unexpected argument: ";
|
||||
err += *i;
|
||||
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str());
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
@ -2812,6 +2817,11 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
|
|||
statusVar = *i;
|
||||
} else if (*i == "SHOW_PROGRESS") {
|
||||
showProgress = true;
|
||||
} else {
|
||||
// Do not return error for compatibility reason.
|
||||
std::string err = "Unexpected argument: ";
|
||||
err += *i;
|
||||
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str());
|
||||
}
|
||||
|
||||
++i;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
^CMake Warning \(dev\) at DOWNLOAD-unused-argument.cmake:[0-9]+ \(file\):
|
||||
Unexpected argument: JUNK
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.$
|
|
@ -0,0 +1,5 @@
|
|||
file(DOWNLOAD
|
||||
"file://${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-unused-argument.txt"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt"
|
||||
JUNK
|
||||
)
|
|
@ -1,6 +1,8 @@
|
|||
include(RunCMake)
|
||||
|
||||
run_cmake(DOWNLOAD-hash-mismatch)
|
||||
run_cmake(DOWNLOAD-unused-argument)
|
||||
run_cmake(UPLOAD-unused-argument)
|
||||
run_cmake(INSTALL-DIRECTORY)
|
||||
run_cmake(INSTALL-MESSAGE-bad)
|
||||
run_cmake(FileOpenFailRead)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
^CMake Warning \(dev\) at UPLOAD-unused-argument.cmake:[0-9]+ \(file\):
|
||||
Unexpected argument: JUNK
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.$
|
|
@ -0,0 +1,5 @@
|
|||
file(UPLOAD
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-unused-argument.txt"
|
||||
"file://${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt"
|
||||
JUNK
|
||||
)
|
Loading…
Reference in New Issue