cmake-3.7.1 looks for libpthreads on ubuntu-14.04
I tried cmake 3.3.0, 3.3.2, and 3.7.1 to get an application to build on our ubuntu-14.04 box. In each case the build would die looking for -lpthreads instead of -lpthread. The cmake files seemed to be asking correctly and in tracking it down I noticed cmake has the same problem when it builds itself:
root@crick:/share/apps/src/cmake-3.7.1# cat ./CMakeFiles/CMakeError.log | grep -i pthreads
Determining if the function pthread_create exists in the pthreads failed with the following output:
/usr/bin/gcc -w -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_bd21b.dir/CheckFunctionExists.c.o -o cmTC_bd21b -rdynamic -lpthreads
/usr/bin/ld: cannot find -lpthreads
root@crick:/share/apps/src/cmake-3.7.1#
The libraries that cmake should find:
root@crick:/share/apps/src/cmake-3.7.1# locate libpthread
/lib/x86_64-linux-gnu/libpthread-2.19.so
/lib/x86_64-linux-gnu/libpthread.so.0
/usr/lib/x86_64-linux-gnu/libpthread.a
/usr/lib/x86_64-linux-gnu/libpthread.so
root@crick:/share/apps/src/cmake-3.7.1# uname -a; lsb_release -a
Linux crick 3.13.0-100-generic #147-Ubuntu SMP Tue Oct 18 16:48:51 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
At least on ubuntu-14.04 cmake should look for libpthread not libpthreads.