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
If googletest is made part of the dependent's build tree (via FetchContent), then usage is different compared to using it from an install location (via find_package).
Ever since FetchContent has been introduced, the example has been using googletest. See here.
Usage differences in code:
# make googletest part of hte build treeinclude(FetchContent)
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master)
FetchContent_MakeAvailable(googletest)
# no ALIAS target, must use non-namespaced target insteadtarget_link_libraries(my_target PRIVATE gtest_main)
# ----# use googletest from an install locationfind_package(GTest REQUIREDCONFIG)
# the install(EXPORT) command namespaces the targetstarget_link_libraries(my_target PRIVATE GTest::gtest_main)
I see from another issue (#3040 (comment)), that due to CMake 3.19 deprecating <2.8.12 there are also plans to set that as the minimum version and conveniently 2.8.12 is also the version that introduced the ALIAS form for add_library.
The text was updated successfully, but these errors were encountered:
We use Bazel almost exclusively internally, so most of the GoogleTest team is relatively unfamiliar with CMake. This seems like a reasonable request, but not one we are likely to prioritize. Would you be willing to send a PR suggesting these changes? Thanks!
If
googletest
is made part of the dependent's build tree (viaFetchContent
), then usage is different compared to using it from an install location (viafind_package
).Ever since
FetchContent
has been introduced, the example has been usinggoogletest
. See here.Usage differences in code:
I see from another issue (#3040 (comment)), that due to CMake 3.19 deprecating
<2.8.12
there are also plans to set that as the minimum version and conveniently 2.8.12 is also the version that introduced theALIAS
form foradd_library
.The text was updated successfully, but these errors were encountered: