I am trying to reuse existing FindCheck.cmake module in my project. However, it appears that Ubuntu, for instance, provides only static libcheck.a library in the system package. FindCheck.cmake uses find_library to locate the library, the library path is successfully found:
-- Found CHECK: /usr/lib/x86_64-linux-gnu/libcheck.a
but finally I get linker error due to missed -pthread (I don’t use pthread in my application, but libcheck does):
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libcheck.a(check_pack.o): undefined reference to symbol '__pthread_unregister_cancel@@GLIBC_2.3.3'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
So what should be a proper way for generic FingXXX.cmake to locate and specify library linker dependencies? As far as I understand there is no pthread dependency on Windows platform, for instance.