[Openmp-commits] [openmp] [OpenMP][OMPT] Remove Threads dependency from omptest link interface (PR #186183)

Michael Halkenhäuser via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 12 10:07:28 PDT 2026


https://github.com/mhalk created https://github.com/llvm/llvm-project/pull/186183

Link against Threads using PRIVATE scope, instead of PUBLIC.
Reason: it imposes a transitive dependency on library users.

If Threads could not be found this could cause a link error.
The issue would manifest, if omptest is used via find_package.

Addresses issues with previous PR https://github.com/llvm/llvm-project/pull/185930

>From b856b4772f48d2cd7a5e69fad49f113a8b229bc6 Mon Sep 17 00:00:00 2001
From: Michael Halkenhaeuser <MichaelGerald.Halkenhauser at amd.com>
Date: Thu, 12 Mar 2026 11:02:17 -0500
Subject: [PATCH] [OpenMP][OMPT] Remove Threads dependency from omptest link
 interface

Link against Threads using PRIVATE scope, instead of PUBLIC.
Reason: it imposes a transitive dependency on library users.

If Threads could not be found this could cause a link error.
The issue would manifest, if omptest is used via find_package.
---
 openmp/tools/omptest/CMakeLists.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/openmp/tools/omptest/CMakeLists.txt b/openmp/tools/omptest/CMakeLists.txt
index 9ff71f49b0abd..6e255ea3cb496 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.



More information about the Openmp-commits mailing list