C++ – How to i fix tbb on CMake


I have this problem.

CMake Error at CMakeLists.txt:14 (find_package): By not providing
"FindTBB.cmake" in CMAKE_MODULE_PATH this project has asked CMake to
find a package configuration file provided by "TBB", but CMake did
not find one.

I could not find a package configuration file provided by "TBB" with any of the following names:


Add the installation prefix of "TBB" to CMAKE_PREFIX_PATH or set
"TBB_DIR" to a directory containing one of the above files. If
"TBB" provides a separate development package or SDK, be sure it has
been installed.

how can i fix this?

Here is my CMakeLists.txt

cmake_minimum_required(VERSION 3.9)



tbb_build(TBB_ROOT "C:/yunus/Git/inteltbb/tbb" CONFIG_DIR TBB_DIR)
find_package(TBB REQUIRED tbb)

add_executable(deneme main.cpp ToDo.cpp ToDo.h)

Best Solution

TBB does not come by default with a FindTBB.cmake module so the guidelines in the error message are a bit misleading.

If your project provides the corresponding FindTBB.cmake module you need to add the path to it and the path to the TBB installation to your CMake call, i.e.

cmake . -G "<your generator here>" -DTBB_DIR=<path to TBB installation> -DCMAKE_PREFIX_PATH=<path to FindTBB.cmake>

Otherwise you need to download a suitable FindTBB.cmake module e.g. https://github.com/schuhschuh/cmake-basis-modules/blob/develop/FindTBB.cmake

This one uses TBB_ROOT instead of TBB_DIR.


Try the binary package integration of TBB first. Comment the include(...) and the tbb_build(...) command and add

target_link_libraries(deneme ${TBB_IMPORTED_TARGETS})

to your CMakeLists.txt after the add_executable call. Then call

cmake . -G "<your generator here>" -DCMAKE_PREFIX_PATH=<path to your TBB installation>
Related Question