diff --git a/v2/build/virtual-target.jam b/v2/build/virtual-target.jam index 7dce7a37a..c6a5a837e 100644 --- a/v2/build/virtual-target.jam +++ b/v2/build/virtual-target.jam @@ -746,6 +746,23 @@ class action actualize-source-type $(dependencies) : $(property-set) ] ; self.actual-sources += [ actualize-source-type $(sources) : $(property-set) ] ; + + # This is used to help bjam find dependencies in generated headers + # in other main targets. + # Say: + # + # make a.h : ....... ; + # exe hello : hello.cpp : a.h ; + # + # However, for bjam to find the dependency the generated target must + # be actualized (i.e. have the jam target). In the above case, + # if we're building just hello ("bjam hello"), 'a.h' won't be + # actualized unless we do it here. + local implicit = [ $(self.properties).get ] ; + for local i in $(implicit) + { + $(i:G=).actualize ; + } } # Determined real properties when trying building with 'properties'. diff --git a/v2/test/implicit_dependency.py b/v2/test/implicit_dependency.py new file mode 100644 index 000000000..f7ff01789 --- /dev/null +++ b/v2/test/implicit_dependency.py @@ -0,0 +1,45 @@ +#!/usr/bin/python + +# Copyright (C) Vladimir Prus 2006. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# Test the is respected even if the +# target referred-to is not build itself, but only referred +# to by . + +from BoostBuild import Tester, List +import string + +t = Tester() + +t.write("Jamroot", """ +make a.h : : gen-header ; +explicit a.h ; + +exe hello : hello.cpp : a.h ; + +actions gen-header +{ + echo "int i;" > $(<) +} +""") + +t.write("hello.cpp", """ +#include "a.h" + +int main() +{ + return i; +} +""") + + + +t.run_build_system() + +t.expect_addition("bin/$toolset/debug/hello.exe") + +t.cleanup() + diff --git a/v2/test/test_all.py b/v2/test/test_all.py index 2c0d80e98..298359b05 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -139,6 +139,7 @@ tests = [ "rebuilds", "disambiguation", "clean", "lib_source_property", + "implicit_dependency", ] if os.name == 'posix':