FindOpenCL: Fix search on macOS.

The original patch was provided by jerry <jerry.c.t@web.de>.
This commit is contained in:
Matthäus G. Chajdas 2016-08-07 19:38:35 +02:00 committed by Brad King
parent 5a8b67b3de
commit 88f2455f04
1 changed files with 10 additions and 3 deletions

View File

@ -53,7 +53,7 @@ function(_FIND_OPENCL_VERSION)
if(APPLE) if(APPLE)
CHECK_SYMBOL_EXISTS( CHECK_SYMBOL_EXISTS(
CL_VERSION_${VERSION} CL_VERSION_${VERSION}
"${OpenCL_INCLUDE_DIR}/OpenCL/cl.h" "${OpenCL_INCLUDE_DIR}/Headers/cl.h"
OPENCL_VERSION_${VERSION}) OPENCL_VERSION_${VERSION})
else() else()
CHECK_SYMBOL_EXISTS( CHECK_SYMBOL_EXISTS(
@ -145,8 +145,15 @@ mark_as_advanced(
OpenCL_LIBRARY) OpenCL_LIBRARY)
if(OpenCL_FOUND AND NOT TARGET OpenCL::OpenCL) if(OpenCL_FOUND AND NOT TARGET OpenCL::OpenCL)
add_library(OpenCL::OpenCL UNKNOWN IMPORTED) if(OpenCL_LIBRARY MATCHES "/([^/]+)\\.framework$")
add_library(OpenCL::OpenCL INTERFACE IMPORTED)
set_target_properties(OpenCL::OpenCL PROPERTIES
INTERFACE_LINK_LIBRARIES "${OpenCL_LIBRARY}")
else()
add_library(OpenCL::OpenCL UNKNOWN IMPORTED)
set_target_properties(OpenCL::OpenCL PROPERTIES
IMPORTED_LOCATION "${OpenCL_LIBRARY}")
endif()
set_target_properties(OpenCL::OpenCL PROPERTIES set_target_properties(OpenCL::OpenCL PROPERTIES
IMPORTED_LOCATION "${OpenCL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${OpenCL_INCLUDE_DIRS}") INTERFACE_INCLUDE_DIRECTORIES "${OpenCL_INCLUDE_DIRS}")
endif() endif()