Fixed some CMake problems when HEADER or SOURCE_FILES were polluted

Status Job ID Name Coverage
  Test
passed #5351
Linux
clang-c++11-debug

00:00:14

passed #5353
Linux
clang-c++11-release

00:00:15

passed #5350
Linux
gcc-c++11-debug

00:00:16

passed #5352
Linux
gcc-c++11-release

00:00:20