CMake: Add add_compiler_rt_osx_object_library to create universal libraries on Mac
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@172979 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
index 0d4317e..7014d17 100644
--- a/cmake/Modules/AddCompilerRT.cmake
+++ b/cmake/Modules/AddCompilerRT.cmake
@@ -18,6 +18,20 @@
endif()
endmacro()
+# Same as above, but adds universal osx library with name "<name>.osx"
+# targeting multiple architectures.
+# add_compiler_rt_osx_object_library(<name> ARCH <architectures>
+# SOURCES <source files>
+# CFLAGS <compile flags>)
+macro(add_compiler_rt_osx_object_library name)
+ parse_arguments(LIB "ARCH;SOURCES;CFLAGS" "" ${ARGN})
+ set(libname "${name}.osx")
+ add_library(${libname} OBJECT ${LIB_SOURCES})
+ set_target_compile_flags(${libname} ${LIB_CFLAGS})
+ set_target_properties(${libname} PROPERTIES
+ OSX_ARCHITECTURES "${LIB_ARCH}")
+endmacro()
+
# Adds static runtime for a given architecture and puts it in the proper
# directory in the build and install trees.
# add_compiler_rt_static_runtime(<name> <arch>