zephyr/cmake/modules/FindoneApi.cmake
Aaron Massey 15cdcc79f0 cmake: Fix FindLlvmLld usage of unimported package
The find_package_handle_standard_args function is used in FindLlvmLld
without being imported. This may cause FindLlvmLld to fail
non-determistically based on if it's evaluated in a CMake build/process
before find_package_handle_standard_args is included.

We should include what we use. Explicitly include
find_package_handle_standard_args.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-06-26 12:40:03 +00:00

27 lines
763 B
CMake

# 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.
include(FindPackageHandleStandardArgs)
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
)