How To Install gmock on CentOS 7

In this tutorial we learn how to install gmock on CentOS 7. gmock is Google C++ Mocking Framework

Introduction

In this tutorial we learn how to install gmock on CentOS 7.

What is gmock

Inspired by jMock, EasyMock, and Hamcrest, and designed with C++’s specifics in mind, Google C++ Mocking Framework (or Google Mock for short) is a library for writing and using C++ mock classes. Google Mock o lets you create mock classes trivially using simple macros, o supports a rich set of matchers and actions, o handles unordered, partially ordered, or completely ordered expectations, o is extensible by users, and o works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and Symbian.

We can use yum or dnf to install gmock on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install gmock.

Install gmock on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install gmock using yum by running the following command:

sudo yum -y install gmock

Install gmock on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install gmock using dnf by running the following command:

sudo dnf -y install gmock

How To Uninstall gmock on CentOS 7

To uninstall only the gmock package we can use the following command:

sudo dnf remove gmock

References

Summary

In this tutorial we learn how to install gmock on CentOS 7 using yum and dnf.