diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 1435859851a2..90847d2c0d1c 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -15,6 +15,10 @@ if (POLICY CMP0051) cmake_policy(SET CMP0051 OLD) endif() +if(POLICY CMP0056) + cmake_policy(SET CMP0056 NEW) +endif() + if(POLICY CMP0057) cmake_policy(SET CMP0057 NEW) endif() diff --git a/llvm/cmake/modules/CheckLinkerFlag.cmake b/llvm/cmake/modules/CheckLinkerFlag.cmake index e96d35e7721e..fe9d01a349cd 100644 --- a/llvm/cmake/modules/CheckLinkerFlag.cmake +++ b/llvm/cmake/modules/CheckLinkerFlag.cmake @@ -1,8 +1,6 @@ include(CheckCXXCompilerFlag) function(check_linker_flag flag out_var) - set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}") check_cxx_compiler_flag("" ${out_var}) - set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) endfunction()