if(NOT DEFINED PANO_CLI) message(FATAL_ERROR "PANO_CLI is required") endif() if(NOT DEFINED OUTPUT_PATH) message(FATAL_ERROR "OUTPUT_PATH is required") endif() if(NOT DEFINED EXPECTED_OUTPUT) message(FATAL_ERROR "EXPECTED_OUTPUT is required") endif() file(REMOVE "${OUTPUT_PATH}") execute_process( COMMAND "${PANO_CLI}" save-project --path "${OUTPUT_PATH}" --width 64 --height 32 --layer-opacity nan RESULT_VARIABLE save_result OUTPUT_VARIABLE save_output ERROR_VARIABLE save_error) if(save_result EQUAL 0) message(FATAL_ERROR "save-project unexpectedly succeeded: ${save_output}${save_error}") endif() string(FIND "${save_output}${save_error}" "${EXPECTED_OUTPUT}" expected_index) if(expected_index EQUAL -1) message(FATAL_ERROR "save-project failure did not contain expected output: ${save_output}${save_error}") endif() if(EXISTS "${OUTPUT_PATH}") message(FATAL_ERROR "save-project created output despite rejected inputs: ${OUTPUT_PATH}") endif()