Create CMake.ConfigureFile test for configure_file

This test checks that configure_file() handles input and output file
arguments as documented.
This commit is contained in:
Brad King 2009-09-16 15:09:58 -04:00
parent 6e8aeba415
commit 229b67a249
6 changed files with 28 additions and 0 deletions

View File

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

View File

@ -0,0 +1 @@
configure_file(.)

View File

@ -0,0 +1 @@
configure_file(. .)

View File

@ -0,0 +1,5 @@
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

@ -0,0 +1,4 @@
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

@ -0,0 +1,16 @@
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")
include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
check_cmake_test(ConfigureFile
DirInput
DirOutput
Relative
BadArg
)