Use direct check to determine whether to add appstreamtest
The variable approach can fail if the file is included twice and the variable doesn't propagate to a scope which includes the second invocation. Since CMake 3.3 we can directly test for the existence of a test.