gtest/1.14.0

Google's C++ test framework
Recipe info
2024-04-18

Available packages
Linux
Windows
macOS
macOS Apple Silicon

Install
Add the following line to your conanfile.txt:
[requires]
gtest/1.14.0

Using gtest

Note

If you are a new Conan user, we recommend reading the how to consume packages tutorial.

If you need additional assistance, please ask a question in the Conan Center Index repository.

Simplest use case consuming this recipe and assuming CMake as your local build tool:

[requires]
gtest/1.14.0
[generators]
CMakeDeps
CMakeToolchain
[layout]
cmake_layout
from conan import ConanFile
from conan.tools.cmake import cmake_layout


class ExampleRecipe(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    generators = "CMakeDeps", "CMakeToolchain"

    def requirements(self):
        self.requires("gtest/1.14.0")

    def layout(self):
        cmake_layout(self)

Now, you can run this Conan command to locally install (and build if necessary) this recipe and its dependencies (if any):

$ conan install conanfile.txt --build=missing

Useful information to take into account to consume this library:


These are the main declared targets:

  • CMake package name(s): GTest
  • CMake target name(s): gtest::gtest
  • gmock => GTest::gmock
    libgtest => GTest::gtest
    gmock_main => GTest::gmock_main
    gtest_main => GTest::gtest_main
    
  • pkg-config file name(s): gtest.pc
  • gmock => gmock.pc
    libgtest => gtest.pc
    gmock_main => gmock_main.pc
    gtest_main => gtest_main.pc
    

A simple use case using the CMake file name and the global target:

# ...
find_package(GTest REQUIRED)
# ...
target_link_libraries(YOUR_TARGET gtest::gtest)

These are all the available headers. Some of these ones might be non-public; make sure of it by visiting the gtest homepage listed above:

#include "gmock/gmock-actions.h"
#include "gmock/gmock-cardinalities.h"
#include "gmock/gmock-function-mocker.h"
#include "gmock/gmock-matchers.h"
#include "gmock/gmock-more-actions.h"
#include "gmock/gmock-more-matchers.h"
#include "gmock/gmock-nice-strict.h"
#include "gmock/gmock-spec-builders.h"
#include "gmock/gmock.h"
#include "gmock/internal/custom/README.md"
#include "gmock/internal/custom/gmock-generated-actions.h"
#include "gmock/internal/custom/gmock-matchers.h"
#include "gmock/internal/custom/gmock-port.h"
#include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-port.h"
#include "gmock/internal/gmock-pp.h"
#include "gtest/gtest-assertion-result.h"
#include "gtest/gtest-death-test.h"
#include "gtest/gtest-matchers.h"
#include "gtest/gtest-message.h"
#include "gtest/gtest-param-test.h"
#include "gtest/gtest-printers.h"
#include "gtest/gtest-spi.h"
#include "gtest/gtest-test-part.h"
#include "gtest/gtest-typed-test.h"
#include "gtest/gtest.h"
#include "gtest/gtest_pred_impl.h"
#include "gtest/gtest_prod.h"
#include "gtest/internal/custom/README.md"
#include "gtest/internal/custom/gtest-port.h"
#include "gtest/internal/custom/gtest-printers.h"
#include "gtest/internal/custom/gtest.h"
#include "gtest/internal/gtest-death-test-internal.h"
#include "gtest/internal/gtest-filepath.h"
#include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-param-util.h"
#include "gtest/internal/gtest-port-arch.h"
#include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-type-util.h"