Menu

Home

What is it?

This project is just a reorganization of Google Test v1.8.1 (without mocks) sources according to Gradle rules.
The result of the build is a static library published on the Web Service of this project as the Maven C++ artifact.

How to use it?

Just put gtest artifact as a dependency in unit test section of your Gradle build script and enjoy :)

Example of build.gradle for library with unit tests:

plugins {
    id 'cpp-library'
    id 'cpp-unit-test'
}

repositories {
    maven {
        url = 'https://gtest-gradle.sourceforge.io/maven'
    }
}

unitTest {
    dependencies {
        implementation 'com.google:gtest:1.8.1'
    }

    binaries.configureEach {
        if (targetMachine.operatingSystemFamily.linux && toolChain instanceof Gcc) {
            linkTask.get().linkerArgs.add('-lpthread')
        }
    }
}

Supported platforms

At moment supported only Windows and Linux x86-64.

Version variants for toolchains

1.8.1 Linux: gcc 8.3.0, Windows: MSVC 2019
1.8.1-1 Linux gcc 8.3.0, Windows: MinGW-W64 8.1.0
1.8.1-2 Linux clang 10.0.0, Windows clang-cl 9.0.0

Want a more comfortable usage?

Please take a look to cpp-build-tuner plugin for Gradle: https://gradle-cpp.sourceforge.io

Only one line in the build script is required:

buildTuner {
    gtest = '1.8.1'
}

Project Members: