Add cmake rules for building LSan common on Mac OS

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@184639 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index e0780cc..a3bc372 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -7,6 +7,7 @@
   add_subdirectory(interception)
   add_subdirectory(sanitizer_common)
   if(NOT ANDROID)
+    add_subdirectory(lsan)
     add_subdirectory(profile)
     add_subdirectory(ubsan)
   endif()
@@ -16,7 +17,6 @@
   add_subdirectory(tsan)
   add_subdirectory(msan)
   add_subdirectory(msandr)
-  add_subdirectory(lsan)
 endif()
 
 # The top-level lib directory contains a large amount of C code which provides
diff --git a/lib/asan/CMakeLists.txt b/lib/asan/CMakeLists.txt
index 3250dca..064ba1f 100644
--- a/lib/asan/CMakeLists.txt
+++ b/lib/asan/CMakeLists.txt
@@ -19,12 +19,10 @@
   asan_stack.cc
   asan_stats.cc
   asan_thread.cc
-  asan_win.cc
-  )
+  asan_win.cc)
 
 set(ASAN_DYLIB_SOURCES
-  ${ASAN_SOURCES}
-  )
+  ${ASAN_SOURCES})
 
 include_directories(..)
 
@@ -58,6 +56,7 @@
     SOURCES ${ASAN_DYLIB_SOURCES}
             $<TARGET_OBJECTS:RTInterception.osx>
             $<TARGET_OBJECTS:RTSanitizerCommon.osx>
+            $<TARGET_OBJECTS:RTLSanCommon.osx>
     CFLAGS ${ASAN_CFLAGS}
     DEFS ${ASAN_COMMON_DEFINITIONS}
     # Dynamic lookup is needed because shadow scale and offset are
diff --git a/lib/asan/lit_tests/TestCases/Linux/lsan_annotations.cc b/lib/asan/lit_tests/TestCases/lsan_annotations.cc
similarity index 100%
rename from lib/asan/lit_tests/TestCases/Linux/lsan_annotations.cc
rename to lib/asan/lit_tests/TestCases/lsan_annotations.cc
diff --git a/lib/lsan/CMakeLists.txt b/lib/lsan/CMakeLists.txt
index 273b18c..d85f144 100644
--- a/lib/lsan/CMakeLists.txt
+++ b/lib/lsan/CMakeLists.txt
@@ -26,7 +26,12 @@
 
 set(LSAN_RUNTIME_LIBRARIES)
 
-if (NOT APPLE AND NOT ANDROID)
+if(APPLE)
+  add_compiler_rt_osx_object_library(RTLSanCommon
+    ARCH ${LSAN_COMMON_SUPPORTED_ARCH}
+    SOURCES ${LSAN_COMMON_SOURCES}
+    CFLAGS ${LSAN_CFLAGS})
+elseif(NOT ANDROID)
   foreach(arch ${LSAN_COMMON_SUPPORTED_ARCH})
     add_compiler_rt_object_library(RTLSanCommon ${arch}
       SOURCES ${LSAN_COMMON_SOURCES}