r354141 - [clang] Add build and install targets for clang libraries

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 15 07:59:04 PST 2019


Author: smeenai
Date: Fri Feb 15 07:59:04 2019
New Revision: 354141

URL: http://llvm.org/viewvc/llvm-project?rev=354141&view=rev
Log:
[clang] Add build and install targets for clang libraries

This is modeled after the existing llvm-libraries target. It's a
convenient way to include all clang libraries in a distribution.

This differs slightly from the llvm-libraries target in that it adds any
library added via add_clang_library, whereas llvm-libraries only
includes targets added via add_llvm_library that didn't use the MODULE
or BUILDTREE_ONLY arguments. add_clang_library doesn't appear to have
any equivalents of those arguments, so the conditions don't apply.

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

Modified:
    cfe/trunk/CMakeLists.txt
    cfe/trunk/cmake/modules/AddClang.cmake

Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=354141&r1=354140&r2=354141&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Feb 15 07:59:04 2019
@@ -543,6 +543,27 @@ if( CLANG_INCLUDE_DOCS )
   add_subdirectory(docs)
 endif()
 
+# Custom target to install all clang libraries.
+add_custom_target(clang-libraries)
+set_target_properties(clang-libraries PROPERTIES FOLDER "Misc")
+
+if(NOT CMAKE_CONFIGURATION_TYPES)
+  add_llvm_install_targets(install-clang-libraries
+                           DEPENDS clang-libraries
+                           COMPONENT clang-libraries)
+endif()
+
+get_property(CLANG_LIBS GLOBAL PROPERTY CLANG_LIBS)
+if(CLANG_LIBS)
+  list(REMOVE_DUPLICATES CLANG_LIBS)
+  foreach(lib ${CLANG_LIBS})
+    add_dependencies(clang-libraries ${lib})
+    if(NOT CMAKE_CONFIGURATION_TYPES)
+      add_dependencies(install-clang-libraries install-${lib})
+    endif()
+  endforeach()
+endif()
+
 add_subdirectory(cmake/modules)
 
 if(CLANG_STAGE)

Modified: cfe/trunk/cmake/modules/AddClang.cmake
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/AddClang.cmake?rev=354141&r1=354140&r2=354141&view=diff
==============================================================================
--- cfe/trunk/cmake/modules/AddClang.cmake (original)
+++ cfe/trunk/cmake/modules/AddClang.cmake Fri Feb 15 07:59:04 2019
@@ -108,6 +108,8 @@ macro(add_clang_library name)
                                  DEPENDS ${name}
                                  COMPONENT ${name})
       endif()
+
+      set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${name})
     endif()
     set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
   else()




More information about the cfe-commits mailing list