FindOpenCL: Fix version detection in presence of multiple versions

Previously our call to `check_symbol_exists` was passing an absolute
path to the `cl.h` header to be included.  However, this might not
include its other headers correctly.  We already set
`CMAKE_REQUIRED_INCLUDES` such that `CL/cl.h` can be included by
the check, so we do not need to include by absolute path.
This commit is contained in:
redradist
2025-02-19 09:57:10 +02:00
committed by Brad King
parent 110b217c14
commit 520eb40e69

View File

@@ -53,12 +53,12 @@ function(_FIND_OPENCL_VERSION)
if(EXISTS ${OpenCL_INCLUDE_DIR}/Headers/cl.h)
check_symbol_exists(
CL_VERSION_${VERSION}
"${OpenCL_INCLUDE_DIR}/Headers/cl.h"
"Headers/cl.h"
OPENCL_VERSION_${VERSION})
else()
check_symbol_exists(
CL_VERSION_${VERSION}
"${OpenCL_INCLUDE_DIR}/CL/cl.h"
"CL/cl.h"
OPENCL_VERSION_${VERSION})
endif()