Fix thread linking for gtest under ubuntu again

This issue is a regression introduced in the last commit.