use string(SHA1) to get a unique name for the output file, use that as a target name in add_custom_target.