diff --git a/doc/src/advanced.xml b/doc/src/advanced.xml
index b946f791d..0b529e5b4 100644
--- a/doc/src/advanced.xml
+++ b/doc/src/advanced.xml
@@ -1147,7 +1147,15 @@ stage dist : hello
;
will find all targets that hello depends on, and install
- all of the which are either executables or libraries.
+ all of the which are either executables or libraries. More
+ specifically, for each target, other targets which were specified as
+ sources or as dependency properties, will be recursively found. One
+ exception is that targets referred with the use feature
+ are not considered, because that feature is typically used to refer to
+ header-only libraries.
+ If the set of target types is specified, only targets of that type
+ will be installed, otherwise, all found target will be installed.
@@ -1258,7 +1266,8 @@ unit-test helpers_test : helpers_test.cpp helpers ;
- use
+
+ use
diff --git a/src/build/virtual-target.jam b/src/build/virtual-target.jam
index f0aa2fea2..bcddfd77c 100644
--- a/src/build/virtual-target.jam
+++ b/src/build/virtual-target.jam
@@ -1091,17 +1091,19 @@ class subvariant
# Returns all targets referenced by this subvariant,
# either directly or indirectly, and
# either as sources, or as dependency properties.
+ # Targets referred with dependency property are returned a properties,
+ # not targets.
rule all-referenced-targets ( )
{
# Find directly referenced targets.
local deps = [ $(self.build-properties).dependency ] ;
- local all-targets = $(self.sources) $(deps:G=) ;
+ local all-targets = $(self.sources) $(deps) ;
# Find other subvariants.
local r ;
for local t in $(all-targets)
{
- r += [ $(t).creating-subvariant ] ;
+ r += [ $(t:G=).creating-subvariant ] ;
}
r = [ sequence.unique $(r) ] ;
for local s in $(r)
diff --git a/src/tools/stage.jam b/src/tools/stage.jam
index ece78c136..dc837a761 100644
--- a/src/tools/stage.jam
+++ b/src/tools/stage.jam
@@ -233,7 +233,15 @@ class stage-target-class : basic-target
{
result += [ $(i).all-referenced-targets ] ;
}
- result = [ sequence.unique $(result) ] ;
+ local result2 ;
+ for local r in $(result)
+ {
+ if $(r:G) !=