[lld] r292909 - [lld][cmake] Fix BUILD_SHARED_LIBS installation

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 07:51:58 PST 2017


r293288.

Thanks,
Hans

On Thu, Jan 26, 2017 at 11:04 AM, Rui Ueyama <ruiu at google.com> wrote:
> Yes, I think we should cherry pick this one.
>
> On Thu, Jan 26, 2017 at 10:26 AM, Hans Wennborg <hans at chromium.org> wrote:
>>
>> This should probably be merged to the release branch. It came up in
>> rc1 testing:
>> http://lists.llvm.org/pipermail/llvm-dev/2017-January/109440.html
>>
>> Rui, what do you think?
>>
>> On Tue, Jan 24, 2017 at 2:41 AM, Pavel Labath via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>> > Author: labath
>> > Date: Tue Jan 24 04:41:02 2017
>> > New Revision: 292909
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=292909&view=rev
>> > Log:
>> > [lld][cmake] Fix BUILD_SHARED_LIBS installation
>> >
>> > Summary:
>> > This fixes a regression caused by D28397, which switched lld from using
>> > add_llvm_library to llvm_add_library. The latter does not automatically
>> > set up
>> > install rules for libraries, as it's expected the project will set them
>> > up
>> > manually based on its own needs.
>> >
>> > This adds the install rules to add_lld_library for lld. They were
>> > inspired by
>> > the similar add_clang_library macro in clang.
>> >
>> > Reviewers: ruiu, beanz, davidlt, EricWF, dtzWill
>> >
>> > Subscribers: mgorny, llvm-commits
>> >
>> > Differential Revision: https://reviews.llvm.org/D29007
>> >
>> > Modified:
>> >     lld/trunk/cmake/modules/AddLLD.cmake
>> >
>> > Modified: lld/trunk/cmake/modules/AddLLD.cmake
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/lld/trunk/cmake/modules/AddLLD.cmake?rev=292909&r1=292908&r2=292909&view=diff
>> >
>> > ==============================================================================
>> > --- lld/trunk/cmake/modules/AddLLD.cmake (original)
>> > +++ lld/trunk/cmake/modules/AddLLD.cmake Tue Jan 24 04:41:02 2017
>> > @@ -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)
>> >
>> >
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>


More information about the llvm-commits mailing list