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) != + { + result2 += $(r:G=) ; + } + } + result = [ sequence.unique $(result2) ] ; } rule check-for-link-compatibility ( * : * ) diff --git a/test/stage.py b/test/stage.py index 873ecf0d2..594ead29d 100644 --- a/test/stage.py +++ b/test/stage.py @@ -138,6 +138,24 @@ t.run_build_system() t.expect_addition("dist/a.exe") t.expect_addition("dist/l.dll") +# Check that properties are ignored the traversing +# target for staging. +t.copy("l.cpp", "l2.cpp") +t.copy("l.cpp", "l3.cpp") +t.write("Jamfile", """ +lib l2 : l2.cpp ; +lib l3 : l3.cpp ; +lib l : l.cpp : l2 l3 ; +exe a : a.cpp l ; +stage dist : a : on EXE LIB ; +""") + +t.rm("dist") +t.run_build_system() +t.expect_addition("dist/l3.dll") +t.expect_nothing("dist/l2.dll") + + t.cleanup()