CMake: Add Darwin-specific linker flags for building loadable modules
authorDouglas Gregor <dgregor@apple.com>
Tue, 10 Nov 2009 15:30:33 +0000 (15:30 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 10 Nov 2009 15:30:33 +0000 (15:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86684 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake

index cb71b7e9605b0d503b8ab128ade029667b5123d6..c0ce897f4f1a14234c458d31ae18f36e6455f765 100755 (executable)
@@ -27,10 +27,16 @@ macro(add_llvm_loadable_module name)
     message(STATUS "Loadable modules not supported on this platform.
 ${name} ignored.")
   else()
-    set(BUILD_SHARED_LIBS ON)
     llvm_process_sources( ALL_FILES ${ARGN} )
     add_library( ${name} MODULE ${ALL_FILES} )
     set_target_properties( ${name} PROPERTIES PREFIX "" )
+
+    if (APPLE)
+      # Darwin-specific linker flags for loadable modules.
+      set_target_properties(${name} PROPERTIES
+        LINK_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
+    endif()
+
     install(TARGETS ${name}
       LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
       ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})