I want to use gmock (Google Mock) as mocking framework for a C++ project in XCode. Therefore I have to compile gmock as gmock.framework
. Unfortunately the project does not come with a dedicated XCode project (gtest has one included).
Creating a Framework project in XCode and building it fails with multiple errors (basically the include paths used in the headers seem to be incorrectly looked up).
So (and sorry for the general question) how to compile gmock as Framework to be able to use it in other XCode Projects?
I was able to get GMock working in Xcode by following these steps:
https://github.com/macmade/gmock-xcode
Open the included Xcode project, build all the targets by pressing the play button, then close the project.
Add the GMock Xcode project to your Xcode project as a subproject (can drag the GoogleMock.xcodeproj
file to the project browser from Finder).
In your testing target under 'Build Phases', add the GoogleMock, gmock, and gtest frameworks under Target Dependencies:
Add the following line to your test files to start using GMock:
#include <GoogleMock/GoogleMock.h>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With