Fix "undefined symbol: omp_get_max_active_levels" in mkl + <nothing else> builds
https://github.com/pytorch/pytorch/issues/116576
--- a/caffe2/CMakeLists.txt
+++ b/caffe2/CMakeLists.txt
@@ -1643,6 +1643,9 @@ if(BUILD_SHARED_LIBS)
   if(CAFFE2_USE_MKL)
     target_link_libraries(torch_global_deps caffe2::mkl)
   endif()
+  if(USE_OPENMP)
+    target_link_libraries(torch_global_deps OpenMP::OpenMP_CXX)
+  endif()
   # The CUDA libraries are linked here for a different reason: in some
   # cases we load these libraries with ctypes, and if they weren't opened
   # with RTLD_GLOBAL, we'll do the "normal" search process again (and
