[PATCH] D29007: [lld][cmake] Fix BUILD_SHARED_LIBS installation

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 02:52:18 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL292909: [lld][cmake] Fix BUILD_SHARED_LIBS installation (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D29007?vs=85334&id=85553#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29007

Files:
  lld/trunk/cmake/modules/AddLLD.cmake


Index: lld/trunk/cmake/modules/AddLLD.cmake
===================================================================
--- lld/trunk/cmake/modules/AddLLD.cmake
+++ lld/trunk/cmake/modules/AddLLD.cmake
@@ -1,6 +1,38 @@
 macro(add_lld_library name)
-  llvm_add_library(${name} ${ARGN})
+  cmake_parse_arguments(ARG
+    "SHARED"
+    ""
+    ""
+    ${ARGN})
+  if(ARG_SHARED)
+    set(ARG_ENABLE_SHARED SHARED)
+  endif()
+  llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS})
   set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
+
+  if (LLD_BUILD_TOOLS)
+    if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+        NOT LLVM_DISTRIBUTION_COMPONENTS)
+      set(export_to_lldtargets EXPORT lldTargets)
+      set_property(GLOBAL PROPERTY LLD_HAS_EXPORTS True)
+    endif()
+
+    install(TARGETS ${name}
+      COMPONENT ${name}
+      ${export_to_lldtargets}
+      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+      RUNTIME DESTINATION bin)
+
+    if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+      add_custom_target(install-${name}
+        DEPENDS ${name}
+        COMMAND "${CMAKE_COMMAND}"
+          -DCMAKE_INSTALL_COMPONENT=${name}
+          -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+    endif()
+    set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
+  endif()
 endmacro(add_lld_library)
 
 macro(add_lld_executable name)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29007.85553.patch
Type: text/x-patch
Size: 1439 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170124/f85e3353/attachment.bin>


More information about the llvm-commits mailing list