Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2421 Discussions

CMake: how to link against libtbb_preview rather than libtbb consistently?

Jorrit_F_
Beginner
484 Views

What is the canonical way to tell a cmake-using library that normally links against libtbb to link against libtbb_preview instead?

Alternatively, is there a way to detect when a program or library tries to link to two incompatible versions of libtbb (like libtbb and libtbb_preview)?

Background

We want a canonical way to do this because we're trying to fix a problem where two libraries ship their own FindTBB.cmake but use slightly incompatible implementations.  In the future we will likely make use of further TBB-using libraries, so we want to come up with a FindTBB.cmake that behaves sensibly.  The only source of what "sensible" means that we could find is TBBConfig.cmake shipped with the binary distributions of TBB from
https://github.com/01org/tbb/releases.

However, one of our libraries requires libtbb_preview in some of its development branches, while the other libraries could use either libtbb or libtbb_preview -- we just need a way to tell it to use the preview version rather than plain libtbb.

The issue in our tracker: https://gitlab.dune-project.org/core/dune-common/issues/85

0 Kudos
1 Reply
Alexey_M_Intel1
Employee
484 Views

Hello, Jorrit F.

If you want to link your application with preview library then you need to import tbb_preview target:

    find_package(TBB REQUIRED tbb_preview)

    target_link_libraries(<your_project> ${TBB_IMPORTED_TARGETS})

or

    target_link_libraries(<your_project> TBB::tbb_preview)

 

Reply