[llvm] Added support for stand-alone cmake object libraries.

Summary:
Currently, add_llvm_library would create an OBJECT library alongside
of a STATIC / SHARED library, but losing the link interface (its
elements would become dependencies instead). To support scenarios
where linking an object library also brings in its usage
requirements, this patch adds support for 'stand-alone' OBJECT
libraries - i.e. without an accompanying SHARED/STATIC library, and
maintaining the link interface defined by the user.

This is useful for cases where, for example, we want to build a part
of a component separately. Using a STATIC target would incur the risk
that symbols not referenced in the consumer would be dropped (which may
be undesirable).

The current application is the ML part of Analysis. It should be part
of the Analysis component, so it may reference other analyses; and (in
upcoming changes) it has dependencies on optional libraries.

Reviewers: karies, davidxl, beanz, phosek, smeenai

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81447
This commit is contained in:
Mircea Trofin 2020-06-09 12:44:07 -07:00
parent a0f967418f
commit 62841415e6
1 changed files with 1 additions and 1 deletions

View File

@ -891,7 +891,7 @@ endmacro(add_llvm_executable name)
# only an object library is built, and no module is built. This is specific to the Polly use case.
#
# The SUBPROJECT argument contains the LLVM project the plugin belongs
# to. If set, the plugin will link statically by default it if the
# to. If set, the plugin will link statically by default it if the
# project was enabled.
function(add_llvm_pass_plugin name)
cmake_parse_arguments(ARG