From 15cdcc79f0fcbe821e0fdf602057796b84d64598 Mon Sep 17 00:00:00 2001 From: Aaron Massey Date: Tue, 20 Jun 2023 14:53:07 -0600 Subject: [PATCH] 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 --- cmake/modules/FindGnuLd.cmake | 2 ++ cmake/modules/FindLlvmLld.cmake | 2 ++ cmake/modules/Findarmclang.cmake | 2 ++ cmake/modules/FindoneApi.cmake | 2 ++ 4 files changed, 8 insertions(+) diff --git a/cmake/modules/FindGnuLd.cmake b/cmake/modules/FindGnuLd.cmake index 9d4377b7e74..412f6badaf7 100644 --- a/cmake/modules/FindGnuLd.cmake +++ b/cmake/modules/FindGnuLd.cmake @@ -23,6 +23,8 @@ # Note that this will use CROSS_COMPILE, if defined, # as a prefix to the linker executable. +include(FindPackageHandleStandardArgs) + # GNULD_LINKER exists on repeated builds or defined manually... if(EXISTS "${GNULD_LINKER}") if(NOT DEFINED GNULD_LINKER_IS_BFD) diff --git a/cmake/modules/FindLlvmLld.cmake b/cmake/modules/FindLlvmLld.cmake index ab7fe1f695b..223e142bf8d 100644 --- a/cmake/modules/FindLlvmLld.cmake +++ b/cmake/modules/FindLlvmLld.cmake @@ -17,6 +17,8 @@ # 'LLVMLLD_VERSION_STRING' # The version of LLVM lld. +include(FindPackageHandleStandardArgs) + # See if the compiler has a preferred linker execute_process(COMMAND ${CMAKE_C_COMPILER} --print-prog-name=ld.lld OUTPUT_VARIABLE LLVMLLD_LINKER diff --git a/cmake/modules/Findarmclang.cmake b/cmake/modules/Findarmclang.cmake index 12c2dc03487..a84a04f163b 100644 --- a/cmake/modules/Findarmclang.cmake +++ b/cmake/modules/Findarmclang.cmake @@ -12,6 +12,8 @@ # 'ARMCLANG_VERSION' # The version of the arm clang toolchain. +include(FindPackageHandleStandardArgs) + if(CMAKE_C_COMPILER) # Parse the 'clang --version' output to find the installed version. execute_process(COMMAND ${CMAKE_C_COMPILER} --target=${triple} --version OUTPUT_VARIABLE ARMCLANG_VERSION) diff --git a/cmake/modules/FindoneApi.cmake b/cmake/modules/FindoneApi.cmake index 0b3ff56fbf3..737aa347007 100644 --- a/cmake/modules/FindoneApi.cmake +++ b/cmake/modules/FindoneApi.cmake @@ -12,6 +12,8 @@ # '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)