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:
Brad King
2022-06-30 11:07:48 -04:00
parent f713146a10
commit fd3ed41109
4 changed files with 20 additions and 0 deletions

View 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()

View File

@@ -0,0 +1 @@
INPUT file

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

View File

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