google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
33.7k stars 9.98k forks source link

[FR]: `FetchContent` on `googletest` subfolder #4467

Closed LecrisUT closed 4 months ago

LecrisUT commented 4 months ago

Does the feature exist in the most recent commit?

No

Why do we need this feature?

Avoid building with gmock

Describe the proposal.

Let's say we want to consume gtest as:

FetchContent_Declare(GTest
        GIT_REPOSITORY https://github.com/google/googletest
        GIT_TAG v1.14.0
        SOURCE_SUBDIR googletest
        FIND_PACKAGE_ARGS CONFIG
)

This fails because GOOGLETEST_VERSION is only defined in top level cmakelists. This means the that the gtest is not independently buildable

Is the feature specific to an operating system, compiler, or build system version?

Build system: CMake + FetchContent

derekmauro commented 4 months ago

Duplicate of #4309.