Use an imported target for the thread library
Raises the cmake requirement to 3.1, which shouldn't be a problem (released 2014) and also lets us use more modern patterns in following changes.