Fix c++ lib cmake builds with non-pthread