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.