summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2019-02-15 15:59:04 +0000
committerShoaib Meenai <smeenai@fb.com>2019-02-15 15:59:04 +0000
commitd705864074e616d2a29c8490ed4cba3750791ab5 (patch)
treee03e08315436cbda9bdc59839e100cfa05d8e335
parentb4ff1abae264396f4634f2fc26395279081a86bb (diff)
downloadbcm5719-llvm-d705864074e616d2a29c8490ed4cba3750791ab5.tar.gz
bcm5719-llvm-d705864074e616d2a29c8490ed4cba3750791ab5.zip
[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 llvm-svn: 354141
-rw-r--r--clang/CMakeLists.txt21
-rw-r--r--clang/cmake/modules/AddClang.cmake2
2 files changed, 23 insertions, 0 deletions
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index c2016a45ca6..40cf7dfdf60 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -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)
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index 7fcf93f1a34..4c3f2d19f74 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -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()
OpenPOWER on IntegriCloud