find_package

I am getting this Cmake error

CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:15 (add_executable):
  Target "StateEstimator" links to target "TBB::tbb" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:15 (add_executable):
  Target "StateEstimator" links to target "TBB::tbbmalloc" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

There’s some missing context here. What ends up mentioning TBB targets? If it is a transitive dependency of some other find_package, that find_package needs to find_dependency(TBB) itself. If your project finds TBB, move the find_package(TBB) to a location that is high enough such that all (literal or variable-based) uses of the target are “after” and “in scope” of the find_package call (IMPORTED targets are, by default, scoped).