MCPcopy Create free account
hub / github.com/boostorg/build / lib

Function lib

v2/tools/builtin.py:448–476  ·  view source on GitHub ↗

The implementation of the 'lib' rule. Beyond standard syntax that rule allows simplified: 'lib a b c ;'.

(names, sources=[], requirements=[], default_build=[], usage_requirements=[])

Source from the content-addressed store, hash-verified

446generators.override("builtin.prebuilt", "builtin.lib-generator")
447
448def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]):
449 """The implementation of the 'lib' rule. Beyond standard syntax that rule allows
450 simplified: 'lib a b c ;'."""
451
452 if len(names) > 1:
453 if any(r.startswith('<name>') for r in requirements):
454 get_manager().errors()("When several names are given to the 'lib' rule\n" +
455 "it is not allowed to specify the <name> feature.")
456
457 if sources:
458 get_manager().errors()("When several names are given to the 'lib' rule\n" +
459 "it is not allowed to specify sources.")
460
461 project = get_manager().projects().current()
462 result = []
463
464 for name in names:
465 r = requirements[:]
466
467 # Support " lib a ; " and " lib a b c ; " syntax.
468 if not sources and not any(r.startswith("<name>") for r in requirements) \
469 and not any(r.startswith("<file") for r in requirements):
470 r.append("<name>" + name)
471
472 result.append(targets.create_typed_metatarget(name, "LIB", sources,
473 r,
474 default_build,
475 usage_requirements))
476 return result
477
478get_manager().projects().add_rule("lib", lib)
479

Callers

nothing calls this directly

Calls 4

get_managerFunction · 0.90
errorsMethod · 0.80
projectsMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected