cmake: Add and use HeaderTest functions for header testing

Each component computes its header set when running cmake, and
writes this out to a Headers.cmake file in the corresponding
test directory.  This header list may then be sourced and used
by the test scripts, avoiding the need for racy globbing of
the source and binary directories (it's racy because the source
generation may not have occured at the time the globbing is
performed).  This makes header test generation race-free and
robust--it will always match the header set exactly.