I looked into automating this for a bit, but need to spend some more time figuring out cmake's scoping rules for lists.