Speed up the GenerateExportHeader unit test (#14453).

Instead of running many small tests with many cmake projects, simply
compare the generated export header against a reference.
Merge topic 'GenerateExportHeader-tests' into next

0f9e5de Speed up the GenerateExportHeader unit test (#14453).