mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
file(GENERATE): Add test case covering use of both INPUT and CONTENT
We have long incorrectly accepted both of these together, and used only the first one. Add a test to preserve compatibility.
This commit is contained in:
8
Tests/RunCMake/File_Generate/InputAndContent-check.cmake
Normal file
8
Tests/RunCMake/File_Generate/InputAndContent-check.cmake
Normal file
@@ -0,0 +1,8 @@
|
||||
file(READ "${RunCMake_TEST_BINARY_DIR}/output-INPUT.txt" input)
|
||||
if(NOT input MATCHES "INPUT file")
|
||||
string(APPEND RunCMake_TEST_FAILED "INPUT incorrectly overridden by CONTENT")
|
||||
endif()
|
||||
file(READ "${RunCMake_TEST_BINARY_DIR}/output-CONTENT.txt" content)
|
||||
if(NOT content MATCHES "CONTENT argument")
|
||||
string(APPEND RunCMake_TEST_FAILED "CONTENT incorrectly overridden by INPUT")
|
||||
endif()
|
||||
1
Tests/RunCMake/File_Generate/InputAndContent-input.txt
Normal file
1
Tests/RunCMake/File_Generate/InputAndContent-input.txt
Normal file
@@ -0,0 +1 @@
|
||||
INPUT file
|
||||
10
Tests/RunCMake/File_Generate/InputAndContent.cmake
Normal file
10
Tests/RunCMake/File_Generate/InputAndContent.cmake
Normal file
@@ -0,0 +1,10 @@
|
||||
file(GENERATE
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output-INPUT.txt"
|
||||
INPUT "${CMAKE_CURRENT_SOURCE_DIR}/InputAndContent-input.txt"
|
||||
CONTENT "CONTENT argument"
|
||||
)
|
||||
file(GENERATE
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output-CONTENT.txt"
|
||||
CONTENT "CONTENT argument"
|
||||
INPUT "${CMAKE_CURRENT_SOURCE_DIR}/InputAndContent-input.txt"
|
||||
)
|
||||
@@ -17,6 +17,7 @@ run_cmake(EmptyCondition2)
|
||||
run_cmake(BadCondition)
|
||||
run_cmake(DebugEvaluate)
|
||||
run_cmake(GenerateSource)
|
||||
run_cmake(InputAndContent)
|
||||
run_cmake(OutputNameMatchesSources)
|
||||
run_cmake(OutputNameMatchesObjects)
|
||||
run_cmake(OutputNameMatchesOtherSources)
|
||||
|
||||
Reference in New Issue
Block a user