Search code examples
c++xcodeunit-testingxcode4googletest

What is the proper way to configure googletest with Xcode 4?


I am following the instructions located at https://github.com/google/googletest/blob/master/googletest/docs/XcodeGuide.md to set up googletest to work with Xcode. However, these instructions seem to be written for Xcode 3. Many things that this article mentions have changed in Xcode 4. What is the proper way to get google test to work with Xcode 4?


Solution

    1. Follow the instructions located at https://github.com/google/googletest/blob/master/googletest/docs/XcodeGuide.md to build the gtest.framework package.
    2. Create a new command line tool target.
    3. Copy the contents of the main.cpp file in the googletest framework into your new main.cpp file for your target. Your main function will kick off the google test.
    4. Execute the new target when you want to run your unit tests.