From 520eb40e693f9c3604cabae2e799acbb581da643 Mon Sep 17 00:00:00 2001 From: redradist Date: Wed, 19 Feb 2025 09:57:10 +0200 Subject: [PATCH] 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. --- Modules/FindOpenCL.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index 697b062266..f50c05ca8d 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -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()