Library target (lib extends build_tgt)

Represents either a shared or static library

Extended by

Library target is extended by the following subtypes:

Returned by

Library target objects are returned by the following functions and methods:

Inherited methods

build_tgt.extract_all_objects()

Acts the same as extract_objects, but returns all object files generated by this target.

By default only objects built for this target are returned to maintain backward compatibility with previous versions. The default value for the recursive kwarg will eventually be changed to true in a future version.

Signature

# Acts the same as `extract_objects`, but returns all object files generated
extracted_obj extract_all_objects(
  recursive : bool  # Also return objects passed to the `objects` argument of this target
)

Arguments

The method build_tgt.extract_all_objects() accepts the following keyword arguments:

Name Type Description Tags
recursive bool

Also return objects passed to the objects argument of this target.

(since 0.46.0)

default = true


build_tgt.extract_objects()

Returns an opaque value representing the object files generated for those source files. This is typically used to take single object files and link them to unit tests or to compile some source files with custom flags. To use the object file(s) in another build target, use the objects: keyword argument to a build_target() or declare_dependency(), or include them in the command line of a custom_target().

Signature

# Returns an opaque value representing the object files generated for those
extracted_obj extract_objects(
  str | file source...,  # Source filenames for which the built objects should be extracted
)

Arguments

The method accepts between 1 and infinity variadic arguments (source...) of type str | file.

Source filenames for which the built objects should be extracted.


build_tgt.found()

Always returns true. This function is meant to make executables objects feature compatible with external_program objects. This simplifies use-cases where an executable is used instead of an external_program.

Signature

(since 0.59.0)

bool found()


build_tgt.full_path()

Returns a full path pointing to the result target file. NOTE: In most cases using the object itself will do the same job as this and will also allow Meson to setup inter-target dependencies correctly. Please file a bug if that doesn't work for you.

Signature

str full_path()


build_tgt.name()

Returns the name of the target.

Signature

(since 0.54.0)

str name()


build_tgt.path()

Does the exact same as build_tgt.full_path(). NOTE: This function is solely kept for compatibility with external_program objects. It will be removed once the, also deprecated, corresponding path() function in the external_program object is removed.

Signature

(since 0.59.0)

DEPRECATED

in 0.59.0

str path()


build_tgt.private_dir_include()

Returns a value that works like include_directories(), but points to the private directory of this target. Usually only needed if an another target needs to access some generated internal headers of this target.

Signature

inc private_dir_include()


The results of the search are