diff --git a/llvm/cmake/modules/LLVMCheckLinkerFlag.cmake b/llvm/cmake/modules/LLVMCheckLinkerFlag.cmake --- a/llvm/cmake/modules/LLVMCheckLinkerFlag.cmake +++ b/llvm/cmake/modules/LLVMCheckLinkerFlag.cmake @@ -12,6 +12,8 @@ # cmake builtin compatible, except we assume lang is C or CXX function(llvm_check_linker_flag lang flag out_var) + cmake_policy(PUSH) + cmake_policy(SET CMP0056 NEW) cmake_push_check_state() set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}") if("${lang}" STREQUAL "C") @@ -22,5 +24,6 @@ message(FATAL_ERROR "\"${lang}\" is not C or CXX") endif() cmake_pop_check_state() + cmake_policy(POP) endfunction() endif()