You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Bazel infrastructure already provides a dedicated gtest_prod library, which was introduced by commit 105579a.
Unfortunately, the same does not yet exist for CMake.
Why do we need this feature?
User story
As a C++ application developer using CMake,
I want GoogleTest's CMake config to provide a dedicated header-only library for gtest_prod.h,
so that I can use the FRIEND_TEST() macro in my application code without having to link against the static GTest::gtest library.
Only my unit tests should link against GTest::gtest.
Describe the proposal.
The implementation should look roughly like this:
In googletest/CMakeLists.txt, add a library named gtest_prod of type INTERFACE.
Include gtest_prod in the list of targets to be installed.
Add a pkgconf template googletest/cmake/gtest_prod.pc.in that adds the correct include-path to the compiler flags.
This will cause a new target, GTest::gtest_prod, to be added to GTestTargets.cmake.
When a user application subsequently links against GTest::gtest_prod in its CMakeLists.txt, the correct include-path will be set. The user application will not pull in the static gtest library.
Is the feature specific to an operating system, compiler, or build system version?
No; this is a platform-agnostic feature.
To the best of my knowledge, it does not pose any specific requirements on the CMake version.
The text was updated successfully, but these errors were encountered:
Does the feature exist in the most recent commit?
The Bazel infrastructure already provides a dedicated
gtest_prod
library, which was introduced by commit 105579a.Unfortunately, the same does not yet exist for CMake.
Why do we need this feature?
User story
As a C++ application developer using CMake,
I want GoogleTest's CMake config to provide a dedicated header-only library for
gtest_prod.h
,so that I can use the
FRIEND_TEST()
macro in my application code without having to link against the staticGTest::gtest
library.Only my unit tests should link against
GTest::gtest
.Describe the proposal.
The implementation should look roughly like this:
googletest/CMakeLists.txt
, add a library namedgtest_prod
of typeINTERFACE
.gtest_prod
in the list of targets to be installed.googletest/cmake/gtest_prod.pc.in
that adds the correct include-path to the compiler flags.This will cause a new target,
GTest::gtest_prod
, to be added toGTestTargets.cmake
.When a user application subsequently links against
GTest::gtest_prod
in itsCMakeLists.txt
, the correct include-path will be set. The user application will not pull in the static gtest library.Is the feature specific to an operating system, compiler, or build system version?
No; this is a platform-agnostic feature.
To the best of my knowledge, it does not pose any specific requirements on the CMake version.
The text was updated successfully, but these errors were encountered: