CMake: Support for building llvm loadable modules.
authorOscar Fuentes <ofv@wanadoo.es>
Tue, 10 Nov 2009 02:45:37 +0000 (02:45 +0000)
committerOscar Fuentes <ofv@wanadoo.es>
Tue, 10 Nov 2009 02:45:37 +0000 (02:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86656 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake
cmake/modules/LLVMLibDeps.cmake
lib/Transforms/Hello/CMakeLists.txt

index 205ddb7663993548e84e89fe8a5fb841df4528f2..cb71b7e9605b0d503b8ab128ade029667b5123d6 100755 (executable)
@@ -22,6 +22,22 @@ macro(add_llvm_library name)
 endmacro(add_llvm_library name)
 
 
+macro(add_llvm_loadable_module name)
+  if( NOT LLVM_ON_UNIX )
+    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 "" )
+    install(TARGETS ${name}
+      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+  endif()
+endmacro(add_llvm_loadable_module name)
+
+
 macro(add_llvm_executable name)
   llvm_process_sources( ALL_FILES ${ARGN} )
   add_executable(${name} ${ALL_FILES})
index 655e23ee6536d81bdeb8d20a2091512009f57b18..1338d562d6b91d986fbe360eba918b6d90b1e577 100644 (file)
@@ -24,7 +24,6 @@ set(MSVC_LIB_DEPS_LLVMCore LLVMSupport LLVMSystem)
 set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport LLVMSystem LLVMTarget)
 set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMSupport)
 set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMSupport LLVMSystem LLVMTarget)
-set(MSVC_LIB_DEPS_LLVMHello LLVMCore LLVMSupport LLVMSystem)
 set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMSystem LLVMTransformUtils)
 set(MSVC_LIB_DEPS_LLVMInterpreter LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMSupport LLVMSystem LLVMTarget)
 set(MSVC_LIB_DEPS_LLVMJIT LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMMC LLVMSupport LLVMSystem LLVMTarget)
index b80d15ba76d60370966a995dc0a0de7ec0a539ee..917b745628de1e747ae3ed5ce9bcde83f2d98730 100644 (file)
@@ -1,3 +1,3 @@
-add_llvm_library( LLVMHello
+add_llvm_loadable_module( LLVMHello
   Hello.cpp
   )