cmake fails at detecting OneTBB because it is looking for header task_scheduler_init.h which has been removed from TBB in version 2021.1.
One solution could be to first try to detect OneTBB using find_package in CONFIG mode, if it fails, try to use current macro to detect an older version of TBB.