configure_file: Warn about unknown arguments
Extend the RunCMake.configure_file test with a case covering possible common typos of the COPYONLY option. Reported-by: Iosif Neitzke <iosif.neitzke@gmail.com>
This commit is contained in:
parent
4abbb1400d
commit
1531df2b86
|
@ -74,6 +74,7 @@ bool cmConfigureFileCommand
|
||||||
this->CopyOnly = false;
|
this->CopyOnly = false;
|
||||||
this->EscapeQuotes = false;
|
this->EscapeQuotes = false;
|
||||||
|
|
||||||
|
std::string unknown_args;
|
||||||
this->AtOnly = false;
|
this->AtOnly = false;
|
||||||
for(unsigned int i=2;i < args.size();++i)
|
for(unsigned int i=2;i < args.size();++i)
|
||||||
{
|
{
|
||||||
|
@ -99,6 +100,18 @@ bool cmConfigureFileCommand
|
||||||
{
|
{
|
||||||
/* Ignore legacy option. */
|
/* Ignore legacy option. */
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unknown_args += " ";
|
||||||
|
unknown_args += args[i];
|
||||||
|
unknown_args += "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!unknown_args.empty())
|
||||||
|
{
|
||||||
|
std::string msg = "configure_file called with unknown argument(s):\n";
|
||||||
|
msg += unknown_args;
|
||||||
|
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !this->ConfigureFile() )
|
if ( !this->ConfigureFile() )
|
||||||
|
|
|
@ -6,3 +6,4 @@ run_cmake(UTF16LE-BOM)
|
||||||
run_cmake(UTF16BE-BOM)
|
run_cmake(UTF16BE-BOM)
|
||||||
run_cmake(UTF32LE-BOM)
|
run_cmake(UTF32LE-BOM)
|
||||||
run_cmake(UTF32BE-BOM)
|
run_cmake(UTF32BE-BOM)
|
||||||
|
run_cmake(UnknownArg)
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
CMake Warning \(dev\) at UnknownArg.cmake:1 \(configure_file\):
|
||||||
|
configure_file called with unknown argument\(s\):
|
||||||
|
|
||||||
|
COPY_ONLY
|
||||||
|
COPYFILE
|
||||||
|
COPY_FILE
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
|
@ -0,0 +1,2 @@
|
||||||
|
configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in UnknownArg.txt
|
||||||
|
@ONLY COPYONLY COPY_ONLY COPYFILE COPY_FILE)
|
Loading…
Reference in New Issue