Googletest: Xcode project for gmock

Created on 16 Feb 2017  路  3Comments  路  Source: google/googletest

I have been using gtest project and would like to be able to use gmock as well but there doesn't appear to be a Xcode project for building gmock.

Most helpful comment

You can use Cmake to autogenerate an Xcode project for gmock, or you can just use Cmake to build.

$ cd googletest-release-1.8.0/
$ cd googlemock/
$ ls
$ mkdir xcode
$ cd xcode 

Build with cmake

$ cmake ..

Create Xcode project from Cmake

$ cmake -G Xcode ..

Output looks like:

-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- The C compiler identification is AppleClang 8.0.0.8000042
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.10")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/paulsolt/dev/github/googletest-release-1.8.0/googlemock/xcode

Open Xcode project

$ ls
CMakeCache.txt      CMakeScripts        gmock.xcodeproj
CMakeFiles      cmake_install.cmake gtest
$ open gmock.xcodeproj/

All 3 comments

You can use Cmake to autogenerate an Xcode project for gmock, or you can just use Cmake to build.

$ cd googletest-release-1.8.0/
$ cd googlemock/
$ ls
$ mkdir xcode
$ cd xcode 

Build with cmake

$ cmake ..

Create Xcode project from Cmake

$ cmake -G Xcode ..

Output looks like:

-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- The C compiler identification is AppleClang 8.0.0.8000042
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.10")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/paulsolt/dev/github/googletest-release-1.8.0/googlemock/xcode

Open Xcode project

$ ls
CMakeCache.txt      CMakeScripts        gmock.xcodeproj
CMakeFiles      cmake_install.cmake gtest
$ open gmock.xcodeproj/

Is there a flag to create a dynamic framework target instead?

I have been cleaning up older and inactive GitHub googletest issues. You may see an issue "closed" if it appears to be inactive/abandoned
Thank you

Was this page helpful?
0 / 5 - 0 ratings