From 33af2776705fddefc77de1810c68a2b61c3c7c9d Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek@chromium.org>
Date: Wed, 18 Jan 2017 05:41:17 +0000
Subject: [PATCH] [CMake] Separate LLVM_ENABLE_LTO and LLVM_ENABLE_LLD

These two are independent: it's possible to use LLD without LTO,
and it's possible to do LTO build without LLD.

Differential Revision: https://reviews.llvm.org/D28821

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292343 91177308-0d34-0410-b5e6-96231b3b80d8
---
 CMakeLists.txt | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c56707e7fb5..417a9077319 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -515,6 +515,10 @@ if (CLANG_ENABLE_BOOTSTRAP)
   set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/)
   set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/)
 
+  if(BOOTSTRAP_LLVM_ENABLE_LLD)
+    add_dependencies(clang-bootstrap-deps lld)
+  endif()
+
   # If the next stage is LTO we need to depend on LTO and possibly lld or LLVMgold
   if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED)
     if(APPLE)
@@ -531,9 +535,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
         -DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR})
     elseif(NOT WIN32)
       add_dependencies(clang-bootstrap-deps llvm-ar llvm-ranlib)
-      if(BOOTSTRAP_LLVM_ENABLE_LLD)
-        add_dependencies(clang-bootstrap-deps lld)
-      elseif(LLVM_BINUTILS_INCDIR)
+      if(NOT BOOTSTRAP_LLVM_ENABLE_LLD AND LLVM_BINUTILS_INCDIR)
         add_dependencies(clang-bootstrap-deps LLVMgold)
       endif()
       set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
-- 
GitLab