From ac42bc870a65d807784cae63e25b9e9ca788eb23 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 15 Aug 2024 09:37:43 -0400 Subject: [PATCH] Hide all gtest symbols in cudftestutil (#16546) By hiding the gtest symbols in cudftestutil it allows consumers of the library to build with a differing version of gtest without issue. Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: - Marcus D. Hanwell (https://github.com/cryos) - Bradley Dice (https://github.com/bdice) URL: https://github.com/rapidsai/cudf/pull/16546 --- cpp/cmake/thirdparty/get_gtest.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cpp/cmake/thirdparty/get_gtest.cmake b/cpp/cmake/thirdparty/get_gtest.cmake index 10e6b026d9a..ec8cbd8c568 100644 --- a/cpp/cmake/thirdparty/get_gtest.cmake +++ b/cpp/cmake/thirdparty/get_gtest.cmake @@ -16,9 +16,18 @@ function(find_and_configure_gtest) include(${rapids-cmake-dir}/cpm/gtest.cmake) + # Mark all the non explicit googletest symbols as hidden. This ensures that libcudftestutil can be + # used by consumers with a different shared gtest. + set(gtest_hide_internal_symbols ON) + # Find or install GoogleTest rapids_cpm_gtest(BUILD_STATIC) + # Mark all the explicit googletest symbols as hidden. This ensures that libcudftestutil can be + # used by consumers with a different shared gtest. + if(TARGET gtest) + target_compile_definitions(gtest PUBLIC "$") + endif() endfunction() find_and_configure_gtest()