Add explicit CMake check for pthread