1# SPDX-License-Identifier: Apache-2.0 2# 3# Copyright (c) 2023 Intel Corporation 4# 5# FindoneApi module for locating oneAPI compiler, icx. 6# 7# The module defines the following variables: 8# 9# 'oneApi_FOUND', 'ONEAPI_FOUND' 10# True if the oneApi toolchain/compiler, icx, was found. 11# 12# 'ONEAPI_VERSION' 13# The version of the oneAPI toolchain. 14 15include(FindPackageHandleStandardArgs) 16 17if(CMAKE_C_COMPILER) 18 # Parse the 'clang --version' output to find the installed version. 19 execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE ONEAPI_VERSION) 20 string(REGEX REPLACE "[^0-9]*([0-9.]+) .*" "\\1" ONEAPI_VERSION ${ONEAPI_VERSION}) 21endif() 22 23find_package_handle_standard_args(oneApi 24 REQUIRED_VARS CMAKE_C_COMPILER 25 VERSION_VAR ONEAPI_VERSION 26) 27