Fix build error caused by pthread lib order

https://github.com/BVLC/caffe/issues/1327
Merge pull request #1332 from tleyden/master

[fix] set pthread last in build order