CMake/Tests/RunCMake/File_Generate/CMP0070-NEW-check.cmake
Brad King 82be694c7a file(GENERATE): Add policy CMP0070 to define relative path behavior
Previously `file(GENERATE)` did not define any behavior for relative
paths given to the `OUTPUT` or `INPUT` arguments.  Define behavior
consistent with CMake conventions and add a policy to provide
compatibility for projects that relied on the old accidental behavior.

Fixes: #16786
2017-06-09 10:38:43 -04:00

14 lines
435 B
CMake

foreach(f
"${RunCMake_TEST_SOURCE_DIR}/relative-input-NEW.txt"
"${RunCMake_TEST_BINARY_DIR}/relative-output-NEW.txt"
)
if(EXISTS "${f}")
file(READ "${f}" content)
if(NOT content MATCHES "^relative-input-NEW[\r\n]*$")
string(APPEND RunCMake_TEST_FAILED "File\n ${f}\ndoes not have expected content.\n")
endif()
else()
string(APPEND RunCMake_TEST_FAILED "Missing\n ${f}\n")
endif()
endforeach()