From d9e182e260948dc86243e30a440ea676afbac18a Mon Sep 17 00:00:00 2001
From: typhoonzero <typhoonzero1986@gmail.com>
Date: Mon, 9 Jul 2018 11:26:38 +0800
Subject: [PATCH] update

---
 cmake/external/mkldnn.cmake | 4 +++-
 cmake/external/mklml.cmake  | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/cmake/external/mkldnn.cmake b/cmake/external/mkldnn.cmake
index 9dc73d239ea..5c095071632 100644
--- a/cmake/external/mkldnn.cmake
+++ b/cmake/external/mkldnn.cmake
@@ -28,7 +28,9 @@ IF(WIN32 OR APPLE)
         "Windows or Mac is not supported with MKLDNN in Paddle yet."
         "Force WITH_MKLDNN=OFF")
     SET(WITH_MKLDNN OFF CACHE STRING "Disable MKLDNN in Windows and MacOS" FORCE)
-    SET(WITH_MKL OFF CACHE STRING "Disable MKL for later scripts" FORCE)
+    IF ((NOT ${WITH_MKLDNN}) AND (NOT ${WITH_MKLML}))
+        SET(WITH_MKL OFF CACHE STRING "Disable MKL for later scripts" FORCE)
+    ENDIF()
     return()
 ENDIF()
 
diff --git a/cmake/external/mklml.cmake b/cmake/external/mklml.cmake
index 30e7b4a8b1e..ba00f0fe63c 100644
--- a/cmake/external/mklml.cmake
+++ b/cmake/external/mklml.cmake
@@ -21,7 +21,9 @@ IF(WIN32 OR APPLE)
         "Windows or Mac is not supported with MKLML in Paddle yet."
         "Force WITH_MKLML=OFF")
     SET(WITH_MKLML OFF CACHE STRING "Disable MKLML package in Windows and MacOS" FORCE)
-    SET(WITH_MKL OFF CACHE STRING "Disable MKL for later scripts" FORCE)
+    IF ((NOT ${WITH_MKLDNN}) AND (NOT ${WITH_MKLML}))
+        SET(WITH_MKL OFF CACHE STRING "Disable MKL for later scripts" FORCE)
+    ENDIF()
     return()
 ENDIF()
 
-- 
GitLab