Link to pthread using the proper cmake variables