Merge branch 'configure_file-NEWLINE_STYLE-no-warn' into release

This commit is contained in:
Brad King 2015-03-09 09:20:58 -04:00
commit 77f3804ab2
28 changed files with 61 additions and 42 deletions

View File

@ -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 += " ";

View File

@ -19,7 +19,6 @@ AddCMakeTest(GetFilenameComponentRealpath "")
AddCMakeTest(Version "")
AddCMakeTest(Message "")
AddCMakeTest(File "")
AddCMakeTest(ConfigureFile "")
AddCMakeTest(SeparateArguments "")
AddCMakeTest(ImplicitLinkInfo "")
AddCMakeTest(ModuleNotices "")

View File

@ -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}")

View File

@ -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}")

View File

@ -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
)

View File

@ -0,0 +1 @@
1

View File

@ -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\)

View File

@ -0,0 +1 @@
1

View File

@ -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\)

View File

@ -0,0 +1 @@
^DirOutput test file$

View 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}")

View File

@ -0,0 +1 @@
DirOutput test file

View File

@ -0,0 +1 @@
1

View File

@ -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\)

View File

@ -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)

View File

@ -0,0 +1 @@
1

View File

@ -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\)

View File

@ -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)

View File

@ -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}")

View File

@ -0,0 +1 @@
1

View File

@ -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\)

View File

@ -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)

View File

@ -0,0 +1 @@
Relative test file

View File

@ -0,0 +1 @@
^Relative test file$

View 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}")

View File

@ -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.