[all-commits] [llvm/llvm-project] f8990f: [libclang] Install both libclang.a and libclang.so...

Shoaib Meenai via All-commits all-commits at lists.llvm.org
Mon Apr 27 13:38:25 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f8990feb125a0f8d3f2892a589bc6fad3c430858
      https://github.com/llvm/llvm-project/commit/f8990feb125a0f8d3f2892a589bc6fad3c430858
  Author: Han Zhu <zhuhan at fb.com>
  Date:   2020-04-27 (Mon, 27 Apr 2020)

  Changed paths:
    M clang/cmake/modules/AddClang.cmake

  Log Message:
  -----------
  [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

When LIBCLANG_BUILD_STATIC=ON and LLVM_ENABLE_PIC=ON, PIC version of
libclang.a and libclang.so are built as expected. However libclang.a is
not installed. Looking at the macro llvm_add_library(), when both SHARED
and STATIC are set, it renames the static library to ${name}_static and
then adds it to targets. But when add_clang_library() calls install, it
only checks if ${name} is in targets.

To work around this issue, loop through both ${name} and ${name}_static
and install both of them if they're in targets. This is still correct if
only shared or static library is built. In those cases, only ${name} is
added to targets and cmake install will generate the right install
script depending on the library's type.

Test Plan:
cmake with LIBCLANG_BUILD_STATIC=ON and then ninja install, from master
and this diff. Compare the result directory trees. Confirm that only
difference is the added libclang.a.

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




More information about the All-commits mailing list