Added in version v21.10.00.

Allow projects to find or build Google Test via CPM with built-in tracking of these dependencies for correct export support.

Uses the version of GTest specified in the version file for consistency across all RAPIDS projects.

rapids_cpm_gtest( [BUILD_EXPORT_SET <export-name>]
                  [INSTALL_EXPORT_SET <export-name>]
                  [<CPM_ARGS> ...])

Record that a CPMFindPackage() for GTest is required in our build directory export set.


Record that a find_dependency() for GTest is required in our install directory export set.


Installation of GTest will occur if an INSTALL_EXPORT_SET is provided, and GTest is added to the project via add_subdirectory by CPM.


Any arguments after CPM_ARGS will be forwarded to the underlying GTest CPMFindPackage`() call

Added in version v24.06.00.


Will build Google Test statically. No local searching for a previously built version will occur.

Result Targets

GTest::gtest, GTest::gmock, GTest::gtest_main, GTest::gmock_main targets will be created

Result Variables

GTest_SOURCE_DIR is set to the path to the source directory of GTest. GTest_BINARY_DIR is set to the path to the build directory of GTest. GTest_ADDED is set to a true value if GTest has not been added before. GTest_VERSION is set to the version of GTest specified by the versions.json.