[build2] [bug] Targets not built if not used by the first target appearing in a buildfile

Boris Kolpackov boris at codesynthesis.com
Sat Mar 24 13:01:09 UTC 2018

Klaim - Joël Lamotte <mjklaim at gmail.com> writes:

> # OK:built
> liba{lib_x}: cxx{x}
> # ISSUE: not built?
> liba{lib_y}: cxx{y}
> # ISSUE: not built?
> liba{lib_z}: cxx{z}
> # ISSUE: not built?
> exe{app} : cxx{app_linking} liba{lib_x} liba{lib_y} liba{lib_z}

By default build2 builds the directory alias target (./). If you
don't mention this target explicitly in your buildfile, then build2
will create it with the first target mentioned in the buildfile
being its sole prerequisite. So something like this:

exe{hello}: cxx{hello}

Is equivalent to:

./: exe{hello}
exe{hello}: cxx{hello}

In your case, if you want to build exe{} and all the lib{} targets,
then you can do:

./: exe{app} liba{lib_x lib_y lib_z}


More information about the users mailing list