[llvm] r341395 - [CMake] Provide a custom target to install LLVM libraries

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 12:10:37 PDT 2018


Author: phosek
Date: Tue Sep  4 12:10:37 2018
New Revision: 341395

URL: http://llvm.org/viewvc/llvm-project?rev=341395&view=rev
Log:
[CMake] Provide a custom target to install LLVM libraries

This simplifies installing all LLVM libraries when doing component
build; now you can include llvm-libraries in distribution components.

Differential Revision: https://reviews.llvm.org/D51603

Modified:
    llvm/trunk/CMakeLists.txt

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=341395&r1=341394&r2=341395&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Tue Sep  4 12:10:37 2018
@@ -983,6 +983,27 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
                              DEPENDS llvm-headers
                              COMPONENT llvm-headers)
   endif()
+
+  # Custom target to install all libraries.
+  add_custom_target(llvm-libraries)
+  set_target_properties(llvm-libraries PROPERTIES FOLDER "Misc")
+
+  if (NOT CMAKE_CONFIGURATION_TYPES)
+    add_llvm_install_targets(install-llvm-libraries
+                             DEPENDS llvm-libraries
+                             COMPONENT llvm-libraries)
+  endif()
+
+  get_property(LLVM_LIBS GLOBAL PROPERTY LLVM_LIBS)
+  if(LLVM_LIBS)
+    list(REMOVE_DUPLICATES LLVM_LIBS)
+    foreach(lib ${LLVM_LIBS})
+      add_dependencies(llvm-libraries ${lib})
+      if (NOT CMAKE_CONFIGURATION_TYPES)
+        add_dependencies(install-llvm-libraries install-${lib})
+      endif()
+    endforeach()
+  endif()
 endif()
 
 # This must be at the end of the LLVM root CMakeLists file because it must run




More information about the llvm-commits mailing list