cmake/Tests/RunCMake/execute_process/InOutErrDirectory.cmake

14 lines
481 B
CMake
Raw Normal View History

2023-12-07 09:12:54 +01:00
file(MAKE_DIRECTORY dir)
file(WRITE dir/in.txt "This is a test")
execute_process(COMMAND ${PRINT_STDIN_EXE} WORKING_DIRECTORY dir INPUT_FILE in.txt OUTPUT_FILE out.txt ERROR_FILE err.txt)
if(NOT EXISTS dir/out.txt)
message(SEND_ERROR "Did not create dir/out.txt")
endif()
file(READ dir/out.txt out)
if(NOT out STREQUAL "This is a test")
message(SEND_ERROR "Did not read dir/in.txt")
endif()
if(NOT EXISTS dir/err.txt)
message(SEND_ERROR "Did not create dir/err.txt")
endif()