How can one generate the file only if it doesn’t exists already?
configure_file will always touch target file and replace with user modified options.
>Solution :
You can check if the file already exists with a conditional statement like if (EXISTS) :
if (NOT EXISTS $outfile)
configure_file($infile $outfile)
endif()