From 53d1b607d5620008dcfc3a294d221072ae7251c9 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 21 Nov 2009 11:49:13 +0000 Subject: [PATCH] Permit path-constant with relative path in config files. Thanks to Johan Nilsson for the bug report. [SVN r57836] --- v2/build-system.jam | 6 ++++++ v2/build/targets.jam | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/v2/build-system.jam b/v2/build-system.jam index 434d2195e..2399d8957 100644 --- a/v2/build-system.jam +++ b/v2/build-system.jam @@ -238,6 +238,12 @@ local rule load-config ( module-name : filename : path + : must-find ? ) "$(filename)" "from" $(where) "." ; } + # Set source location so that path-constant in config files + # with relative paths work. This is of most importance + # for project-config.jam, but may be used in other + # config files as well. + local attributes = [ project.attributes $(module-name) ] ; + $(attributes).set source-location : $(where:D) : exact ; modules.load $(module-name) : $(filename) : $(path) ; project.load-used-projects $(module-name) ; } diff --git a/v2/build/targets.jam b/v2/build/targets.jam index b6ccc0131..38736769a 100644 --- a/v2/build/targets.jam +++ b/v2/build/targets.jam @@ -485,7 +485,17 @@ class project-target : abstract-target local r ; for local v in $(value) { - v = [ path.root [ path.make $(v) ] $(self.location) ] ; + local l = $(self.location) ; + if ! $(l) + { + # Project corresponding to config files do not have + # 'location' attribute, but do have source location. + # It might be more reasonable to make every project have + # a location and use some other approach to prevent buildable + # targets in config files, but that's for later. + l = [ get source-location ] ; + } + v = [ path.root [ path.make $(v) ] $(l) ] ; # Now make the value absolute path. v = [ path.root $(v) [ path.pwd ] ] ; # Constants should be in platform-native form.