build: Fix compilation with tests and precompiled headers enabled

Change-Id: I996c06e1340cc5d1e731daf879b209c2976fe0e0
Refs: #2102