[CMake] Fix Xcode build with LLVM_ENABLE_OBJLIB.
[oota-llvm.git] / cmake / modules / AddLLVM.cmake
index 840a860b0163aad402e30b6dafc4bc3c336b3566..8ec6311c3bf4dc5f3f776cc174dfdadd878eb661 100644 (file)
@@ -590,6 +590,12 @@ macro(add_llvm_executable name)
 
   add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
 
+  if(XCODE)
+    # Note: the dummy.cpp source file provides no definitions. However,
+    # it forces Xcode to properly link the static library.
+    list(APPEND ALL_FILES "${LLVM_SOURCE_DIR}/cmake/dummy.cpp")
+  endif()
+
   if( EXCLUDE_FROM_ALL )
     add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
   else()