tests: fix build of tests when the build directory is outside source tree (closes #178)