xpu: fix 3rd party builds on systems with cmake<3.25 (#135767)

Cmake LINUX variable is available on starting from cmake 3.25. Better to use CMAKE_SYSTEM_NAME instead to relax cmake version requirement.

See: https://cmake.org/cmake/help/v3.25/variable/LINUX.html
Fixes: #135766
Pull Request resolved: https://github.com/pytorch/pytorch/pull/135767
Approved by: https://github.com/malfet, https://github.com/guangyey
This commit is contained in:
Dmitry Rogozhkin 2024-09-12 05:30:59 +00:00 committed by PyTorch MergeBot
parent 6354271178
commit 9852c6d236

View File

@ -49,7 +49,10 @@ find_file(
)
# Find SYCL library fullname.
if(LINUX)
# Don't use if(LINUX) here since this requires cmake>=3.25 and file is installed
# and used by other projects.
# See: https://cmake.org/cmake/help/v3.25/variable/LINUX.html
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
find_library(
SYCL_LIBRARY
NAMES sycl-preview