Merge topic 'configure_file-NEWLINE_STYLE-no-warn'
024e25e4
Tests: Add more signature tests to RunCMake.configure_file test3ef776fc
configure_file: Do not warn about newline style arguments
This commit is contained in:
commit
fa4617b7ea
|
@ -100,6 +100,13 @@ bool cmConfigureFileCommand
|
|||
{
|
||||
/* Ignore legacy option. */
|
||||
}
|
||||
else if(args[i] == "NEWLINE_STYLE" ||
|
||||
args[i] == "LF" || args[i] == "UNIX" ||
|
||||
args[i] == "CRLF" || args[i] == "WIN32" ||
|
||||
args[i] == "DOS")
|
||||
{
|
||||
/* Options handled by NewLineStyle member above. */
|
||||
}
|
||||
else
|
||||
{
|
||||
unknown_args += " ";
|
||||
|
|
|
@ -19,7 +19,6 @@ AddCMakeTest(GetFilenameComponentRealpath "")
|
|||
AddCMakeTest(Version "")
|
||||
AddCMakeTest(Message "")
|
||||
AddCMakeTest(File "")
|
||||
AddCMakeTest(ConfigureFile "")
|
||||
AddCMakeTest(SeparateArguments "")
|
||||
AddCMakeTest(ImplicitLinkInfo "")
|
||||
AddCMakeTest(ModuleNotices "")
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-DirOutput.txt "DirOutput test file\n")
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-DirOutput)
|
||||
configure_file(ConfigureFile-DirOutput.txt ConfigureFile-DirOutput)
|
||||
file(READ ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-DirOutput/ConfigureFile-DirOutput.txt out)
|
||||
message("${out}")
|
|
@ -1,4 +0,0 @@
|
|||
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-Relative-In.txt "Relative test file\n")
|
||||
configure_file(ConfigureFile-Relative-In.txt ConfigureFile-Relative-Out.txt)
|
||||
file(READ ${CMAKE_CURRENT_BINARY_DIR}/ConfigureFile-Relative-Out.txt out)
|
||||
message("${out}")
|
|
@ -1,28 +0,0 @@
|
|||
set(DirInput-RESULT 1)
|
||||
set(DirInput-STDERR "is a directory")
|
||||
set(DirOutput-RESULT 0)
|
||||
set(DirOutput-STDERR "DirOutput test file")
|
||||
set(Relative-RESULT 0)
|
||||
set(Relative-STDERR "Relative test file")
|
||||
set(BadArg-RESULT 1)
|
||||
set(BadArg-STDERR "called with incorrect number of arguments")
|
||||
set(NewLineStyle-NoArg-RESULT 1)
|
||||
set(NewLineStyle-NoArg-STDERR "NEWLINE_STYLE must set a style:")
|
||||
set(NewLineStyle-WrongArg-RESULT 1)
|
||||
set(NewLineStyle-WrongArg-STDERR "NEWLINE_STYLE sets an unknown style")
|
||||
set(NewLineStyle-ValidArg-RESULT 0)
|
||||
set(NewLineStyle-ValidArg-STDERR )
|
||||
set(NewLineStyle-COPYONLY-RESULT 1)
|
||||
set(NewLineStyle-COPYONLY-STDERR "COPYONLY could not be used in combination")
|
||||
|
||||
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
|
||||
check_cmake_test(ConfigureFile
|
||||
DirInput
|
||||
DirOutput
|
||||
Relative
|
||||
BadArg
|
||||
NewLineStyle-NoArg
|
||||
NewLineStyle-WrongArg
|
||||
NewLineStyle-ValidArg
|
||||
NewLineStyle-COPYONLY
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,4 @@
|
|||
CMake Error at BadArg.cmake:[0-9]+ \(configure_file\):
|
||||
configure_file called with incorrect number of arguments, expected 2
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,8 @@
|
|||
CMake Error at DirInput.cmake:[0-9]+ \(configure_file\):
|
||||
configure_file input location
|
||||
|
||||
.*/Tests/RunCMake/configure_file/.
|
||||
|
||||
is a directory but a file was expected.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1 @@
|
|||
^DirOutput test file$
|
|
@ -0,0 +1,4 @@
|
|||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DirOutput)
|
||||
configure_file(DirOutput.txt DirOutput)
|
||||
file(READ ${CMAKE_CURRENT_BINARY_DIR}/DirOutput/DirOutput.txt out)
|
||||
message("${out}")
|
|
@ -0,0 +1 @@
|
|||
DirOutput test file
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,4 @@
|
|||
CMake Error at NewLineStyle-COPYONLY.cmake:[0-9]+ \(configure_file\):
|
||||
configure_file COPYONLY could not be used in combination with NEWLINE_STYLE
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -1,3 +1,3 @@
|
|||
set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
|
||||
set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
|
||||
file(WRITE ${file_name} "Data\n")
|
||||
configure_file(${file_name} ${file_name}.out COPYONLY NEWLINE_STYLE DOS)
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,5 @@
|
|||
CMake Error at NewLineStyle-NoArg.cmake:[0-9]+ \(configure_file\):
|
||||
configure_file NEWLINE_STYLE must set a style: LF, CRLF, UNIX, DOS, or
|
||||
WIN32
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -1,3 +1,3 @@
|
|||
set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
|
||||
set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
|
||||
file(WRITE ${file_name} "Data\n")
|
||||
configure_file(${file_name} ${file_name}.out NEWLINE_STYLE)
|
|
@ -1,4 +1,4 @@
|
|||
set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
|
||||
set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
|
||||
|
||||
function(test_eol style in out)
|
||||
file(WRITE ${file_name} "${in}")
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,5 @@
|
|||
CMake Error at NewLineStyle-WrongArg.cmake:[0-9]+ \(configure_file\):
|
||||
configure_file NEWLINE_STYLE sets an unknown style, only LF, CRLF, UNIX,
|
||||
DOS, and WIN32 are supported
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
|
@ -1,3 +1,3 @@
|
|||
set(file_name ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureFile-NewLineStyle.txt)
|
||||
set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
|
||||
file(WRITE ${file_name} "Data\n")
|
||||
configure_file(${file_name} ${file_name}.out NEWLINE_STYLE FOO)
|
|
@ -0,0 +1 @@
|
|||
Relative test file
|
|
@ -0,0 +1 @@
|
|||
^Relative test file$
|
|
@ -0,0 +1,3 @@
|
|||
configure_file(Relative-In.txt Relative-Out.txt)
|
||||
file(READ ${CMAKE_CURRENT_BINARY_DIR}/Relative-Out.txt out)
|
||||
message("${out}")
|
|
@ -7,6 +7,14 @@ run_cmake(UTF16BE-BOM)
|
|||
run_cmake(UTF32LE-BOM)
|
||||
run_cmake(UTF32BE-BOM)
|
||||
run_cmake(UnknownArg)
|
||||
run_cmake(DirInput)
|
||||
run_cmake(DirOutput)
|
||||
run_cmake(Relative)
|
||||
run_cmake(BadArg)
|
||||
run_cmake(NewLineStyle-NoArg)
|
||||
run_cmake(NewLineStyle-WrongArg)
|
||||
run_cmake(NewLineStyle-ValidArg)
|
||||
run_cmake(NewLineStyle-COPYONLY)
|
||||
|
||||
if(RunCMake_GENERATOR MATCHES "Make")
|
||||
# Use a single build tree for a few tests without cleaning.
|
||||
|
|
Loading…
Reference in New Issue