From 69af5e0b9aca0e30d31e71ca6440b7209b42d317 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 28 Nov 2005 09:26:41 +0000 Subject: [PATCH] Unbreak libraries using Qt, together with moccable classes in .cpp files. The generator that handles moccable cpp files has to actualize created targets right away. However, it did that before calling virtual-target.register, so, if the generator was invoked two times on the same target, it will produce two identical targets and call .actualize on it. The second invocation would trigger "duplicate target" error. [SVN r31797] --- v2/tools/cast.jam | 3 ++- v2/tools/qt.jam | 8 +++++--- v2/tools/qt4.jam | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/v2/tools/cast.jam b/v2/tools/cast.jam index 709181d5c..7eedd4f2d 100644 --- a/v2/tools/cast.jam +++ b/v2/tools/cast.jam @@ -54,7 +54,8 @@ class cast-target-class : typed-target ECHO "error: when building " [ full-name ] ; EXIT ; } - result += [ $(s).clone-with-different-type $(self.type) ] ; + local r = [ $(s).clone-with-different-type $(self.type) ] ; + result += [ virtual-target.register $(r) ] ; } return [ property-set.empty ] $(result) ; diff --git a/v2/tools/qt.jam b/v2/tools/qt.jam index 33587cc91..a8d8839da 100644 --- a/v2/tools/qt.jam +++ b/v2/tools/qt.jam @@ -131,7 +131,7 @@ class moc-h-generator : generator { if ! $(sources[2]) && [ $(sources[1]).type ] = MOCCABLE_CPP { - name = [ $(sources[0]).name ] ; + name = [ $(sources[1]).name ] ; name = $(name:B) ; local a = [ new action $(sources[1]) : qt.moc.cpp : @@ -140,14 +140,16 @@ class moc-h-generator : generator local target = [ new file-target $(name) : MOC : $(project) : $(a) ] ; + local r = [ virtual-target.register $(target) ] ; + # Since this generator will return H target, the linking generator # won't use it at all, and won't set any dependency on it. # However, we need to target to be seen by bjam, so that dependency # from sources to this generated header is detected -- if jam does # not know about this target, it won't do anything. - DEPENDS all : [ $(target).actualize ] ; + DEPENDS all : [ $(r).actualize ] ; - return [ virtual-target.register $(target) ] ; + return $(r) ; } } } diff --git a/v2/tools/qt4.jam b/v2/tools/qt4.jam index 1a0476bfb..feac69708 100644 --- a/v2/tools/qt4.jam +++ b/v2/tools/qt4.jam @@ -254,14 +254,16 @@ class moc-h-generator : generator local target = [ new file-target $(name) : MOC : $(project) : $(a) ] ; + local r = [ virtual-target.register $(target) ] ; + # Since this generator will return H target, the linking generator # won't use it at all, and won't set any dependency on it. # However, we need to target to be seen by bjam, so that dependency # from sources to this generated header is detected -- if jam does # not know about this target, it won't do anything. - DEPENDS all : [ $(target).actualize ] ; + DEPENDS all : [ $(r).actualize ] ; - return [ virtual-target.register $(target) ] ; + return $(r) ; } } }