[CMake] [darwin] [builtins] Make darwin_lipo_libs take OUTPUT_DIR as an option. NFC.

This refactoring will allow me to reuse this function when calling lipo with outputs in different directories.

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@248639 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
index 55a398a..696c397 100644
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -185,19 +185,19 @@
 function(darwin_lipo_libs name)
   cmake_parse_arguments(LIB
     ""
-    "PARENT_TARGET"
+    "PARENT_TARGET;OUTPUT_DIR"
     "LIPO_FLAGS;DEPENDS"
     ${ARGN})
-  add_custom_command(OUTPUT ${COMPILER_RT_LIBRARY_OUTPUT_DIR}/lib${name}.a
+  add_custom_command(OUTPUT ${LIB_OUTPUT_DIR}/lib${name}.a
     COMMAND lipo -output
-            ${COMPILER_RT_LIBRARY_OUTPUT_DIR}/lib${name}.a
+            ${LIB_OUTPUT_DIR}/lib${name}.a
             -create ${LIB_LIPO_FLAGS}
     DEPENDS ${LIB_DEPENDS}
     )
   add_custom_target(${name}
-    DEPENDS ${COMPILER_RT_LIBRARY_OUTPUT_DIR}/lib${name}.a)
+    DEPENDS ${LIB_OUTPUT_DIR}/lib${name}.a)
   add_dependencies(${LIB_PARENT_TARGET} ${name})
-  install(FILES ${COMPILER_RT_LIBRARY_OUTPUT_DIR}/lib${name}.a
+  install(FILES ${LIB_OUTPUT_DIR}/lib${name}.a
     DESTINATION ${COMPILER_RT_INSTALL_PATH})
 endfunction()
 
@@ -269,11 +269,13 @@
     darwin_lipo_libs(clang_rt.cc_kext_${os}
                     PARENT_TARGET builtins
                     LIPO_FLAGS ${${os}_cc_kext_lipo_flags}
-                    DEPENDS ${${os}_cc_kext_libs})
+                    DEPENDS ${${os}_cc_kext_libs}
+                    OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
     darwin_lipo_libs(clang_rt.${os}
                     PARENT_TARGET builtins
                     LIPO_FLAGS ${${os}_builtins_lipo_flags}
-                    DEPENDS ${${os}_builtins_libs})
+                    DEPENDS ${${os}_builtins_libs}
+                    OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
   endforeach()
 endmacro()