Fix TestDuplicateBodyTemplate.cxx

try_compile tries to build an executable, not an object file.
Also add a message in CMakeLists.txt.