Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2455 Discussions

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


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)?


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

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:

0 Kudos
1 Reply

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})


    target_link_libraries(<your_project> TBB::tbb_preview)


0 Kudos