Add -pthread to CXXFLAGS