[OpenMP][OMPT] Remove Threads dependency from omptest link interface (#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
This commit is contained in:
Michael Halkenhäuser
2026-03-12 18:16:36 +01:00
committed by GitHub
parent 77f6270a17
commit 4f2dea8ac7

View File

@@ -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.