diff --git a/openmp/tools/omptest/CMakeLists.txt b/openmp/tools/omptest/CMakeLists.txt index 9ff71f49b0ab..6e255ea3cb49 100644 --- a/openmp/tools/omptest/CMakeLists.txt +++ b/openmp/tools/omptest/CMakeLists.txt @@ -87,9 +87,10 @@ if ((NOT LIBOMPTEST_BUILD_STANDALONE) OR LIBOMPTEST_BUILD_UNITTESTS) # available to dependant targets, e.g. for unit tests. target_link_libraries(omptest PUBLIC default_gtest) - # Link against Threads (recommended for GTest). + # Link against Threads, which may be required for GTest. + # But keep it out of the link interface to avoid transitive dependencies. find_package(Threads REQUIRED) - target_link_libraries(omptest PUBLIC Threads::Threads) + target_link_libraries(omptest PRIVATE Threads::Threads) # Ensure that embedded GTest symbols are exported from libomptest.so even in # builds that default to hidden.