Fix cmake test builds when building as a sub-project