From 6aad1fb5e9720ab389bda5ff330d3bf4561fe6ca Mon Sep 17 00:00:00 2001
From: Chris Bieneman <beanz@apple.com>
Date: Mon, 29 Aug 2016 20:18:52 +0000
Subject: [PATCH] [CMake] Builtins build needs LLVM_*_OUTPUT_INTDIR variables

This allows the builtins archives to build into the correct subdirectory under the binary dir. Addresses the issue discussed in D24001.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280002 91177308-0d34-0410-b5e6-96231b3b80d8
---
 runtimes/CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 4d0747680a4..a787fc9b5b7 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -123,6 +123,8 @@ else() # if this is included from LLVM's CMake
   if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt)
     llvm_ExternalProject_Add(builtins
                              ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt/lib/builtins
+                             CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
+                                        -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
                              PASSTHROUGH_PREFIXES COMPILER_RT
                              USE_TOOLCHAIN)
     set(deps builtins)