2023-01-21 07:21:23 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
#
|
|
|
|
# Copyright (c) 2023 Intel Corporation
|
|
|
|
#
|
|
|
|
# FindoneApi module for locating oneAPI compiler, icx.
|
|
|
|
#
|
|
|
|
# The module defines the following variables:
|
|
|
|
#
|
|
|
|
# 'oneApi_FOUND', 'ONEAPI_FOUND'
|
|
|
|
# True if the oneApi toolchain/compiler, icx, was found.
|
|
|
|
#
|
|
|
|
# 'ONEAPI_VERSION'
|
|
|
|
# The version of the oneAPI toolchain.
|
|
|
|
|
2023-06-21 04:53:07 +08:00
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
|
2023-01-21 07:21:23 +08:00
|
|
|
if(CMAKE_C_COMPILER)
|
|
|
|
# Parse the 'clang --version' output to find the installed version.
|
|
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE ONEAPI_VERSION)
|
|
|
|
string(REGEX REPLACE "[^0-9]*([0-9.]+) .*" "\\1" ONEAPI_VERSION ${ONEAPI_VERSION})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_package_handle_standard_args(oneApi
|
|
|
|
REQUIRED_VARS CMAKE_C_COMPILER
|
|
|
|
VERSION_VAR ONEAPI_VERSION
|
|
|
|
)
|