This is an automated email from the ASF dual-hosted git repository.
masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 497f5f6223 Fix a case of linking to wrong OpenCL library (#11215)
497f5f6223 is described below
commit 497f5f62230935a15c1af6d528890f9b76317445
Author: Andrey Malyshev <[email protected]>
AuthorDate: Thu May 12 10:22:32 2022 +0300
Fix a case of linking to wrong OpenCL library (#11215)
if explicit path to OpenCL SDK was pointed in USE_OPENCL option
---
cmake/utils/FindOpenCL.cmake | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cmake/utils/FindOpenCL.cmake b/cmake/utils/FindOpenCL.cmake
index c65d46ecab..f2931332fc 100644
--- a/cmake/utils/FindOpenCL.cmake
+++ b/cmake/utils/FindOpenCL.cmake
@@ -50,7 +50,9 @@ macro(find_opencl use_opencl)
if (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY STREQUAL "ONLY")
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
endif()
- find_library(OpenCL_LIBRARIES NAMES OpenCL PATHS ${__opencl_sdk}/lib
${__opencl_sdk}/lib64 ${__opencl_sdk}/lib/x64/)
+ # we are in the section dedicated to the explicit pointing of OpenCL SDK
path, we must not
+ # look for the OpenCL library by default path, but should be limited by
provided SDK
+ find_library(OpenCL_LIBRARIES NAMES OpenCL NO_DEFAULT_PATH PATHS
${__opencl_sdk}/lib ${__opencl_sdk}/lib64 ${__opencl_sdk}/lib/x64/)
if(OpenCL_LIBRARIES)
set(OpenCL_FOUND TRUE)
endif()