if (INPUT)
  if (OUTPUT)
    message(STATUS "Reading ${INPUT} ...")
    FILE(READ "${INPUT}" in0) 
    string(REPLACE "PAPI" "WAPI" in1 "${in0}")
    string(REPLACE "pnga_" "wnga_" in2 "${in1}")
    string(REGEX REPLACE "typedef[^;]*;" "" in3 "${in2}")
    message(STATUS "Writing ${OUTPUT} ...")
    FILE(WRITE "${OUTPUT}" "${in3}")
  else (OUTPUT)
    message(ERROR "OUTPUT variable must be set")
  endif (OUTPUT)
else (INPUT)
  message(ERROR "INPUT variable must be set")
endif (INPUT)
