From a2e7edbd4cf02fe92067e637bbd2b65bc2a12e51 Mon Sep 17 00:00:00 2001
From: Tobias Leibner <tobias.leibner@googlemail.com>
Date: Fri, 4 Oct 2019 16:55:44 +0200
Subject: [PATCH] [cmake] fix mkl and tbb hints

---
 cmake/modules/FindMKL.cmake |  2 +-
 cmake/modules/FindTBB.cmake | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/cmake/modules/FindMKL.cmake b/cmake/modules/FindMKL.cmake
index 57ed55074..f276088fd 100644
--- a/cmake/modules/FindMKL.cmake
+++ b/cmake/modules/FindMKL.cmake
@@ -12,7 +12,7 @@
 
 include(Hints)
 
-set(mkl_hints ${hint_prefixes})
+set(mkl_hints ${root_hints})
 set(mkl_lib_hints "")
 set(mkl_include_hints "")
 list(APPEND mkl_hints "/opt/intel/mkl/" "$ENV{HOME}/intel/mkl/")
diff --git a/cmake/modules/FindTBB.cmake b/cmake/modules/FindTBB.cmake
index 76e743823..fc128cc16 100644
--- a/cmake/modules/FindTBB.cmake
+++ b/cmake/modules/FindTBB.cmake
@@ -67,6 +67,15 @@
 
 include(Hints)
 
+set(tbb_hints ${root_hints})
+set(tbb_lib_hints "")
+set(tbb_include_hints "")
+set(tbb_bin_hints "")
+list(APPEND tbb_hints "/opt/intel/tbb/" "$ENV{HOME}/intel/tbb/")
+append_to_each("${tbb_hints}" "lib/intel64" tbb_lib_hints)
+append_to_each("${tbb_hints}" "include/" tbb_include_hints)
+append_to_each("${tbb_hints}" "bin/" tbb_bin_hints)
+
 option(TBB_DEBUG "Turn on TBB debugging (modifies compiler flags and links against debug version of libraries)")
 
 # source for our little test program. We have to compile this multiple times, so store it in a variable for DRY and
@@ -125,6 +134,8 @@ endfunction()
 
 # Check whether the user gave us an existing tbbvars.sh file
 find_file(TBB_VARS_SH tbbvars.sh DOC "Path to tbbvars.sh script" NO_DEFAULT_PATH)
+# now we try to find tbbvars.sh on our own
+find_file(TBB_VARS_SH tbbvars.sh HINTS ${tbb_bin_hints} DOC "Path to tbbvars.sh script")
 
 if(TBB_VARS_SH)
   parse_tbb_vars_sh()
@@ -133,7 +144,7 @@ else() # Try to find TBB in standard include paths
             PATHS ENV
                   CPATH
                   ${TBB_INCLUDE_DIR}
-                  ${include_hints}
+                  ${tbb_include_hints}
             DOC "Path to TBB include directory") # Try to find some version of the TBB library in standard library
                                                  # paths
   find_path(TBB_LIBRARY_DIR
@@ -141,7 +152,7 @@ else() # Try to find TBB in standard include paths
             "${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}"
             "${CMAKE_SHARED_LIBRARY_PREFIX}tbb_preview_debug${CMAKE_SHARED_LIBRARY_SUFFIX}"
             "${CMAKE_SHARED_LIBRARY_PREFIX}tbb_debug${CMAKE_SHARED_LIBRARY_SUFFIX}"
-            PATHS ENV LIBRARY_PATH ${lib_hints}
+            PATHS ENV LIBRARY_PATH ${tbb_lib_hints}
             DOC "Path to TBB library directory")
 endif()
 
-- 
GitLab