diff --git a/src/build/project.jam b/src/build/project.jam index b4628a9b7..38f7a5366 100644 --- a/src/build/project.jam +++ b/src/build/project.jam @@ -380,8 +380,12 @@ local rule initialize ( local parent-build-dir = [ $(pattributes).get build-dir ] ; if $(parent-build-dir) { - local parent-dir = [ path.parent $(parent) ] ; - local our-dir = [ path.parent $(jamfile) ] ; + # Have to compute relative path from parent dir to our dir + # Convert both paths to absolute, since we cannot + # find relative path from ".." to "." + local pwd = [ path.pwd ] ; + local parent-dir = [ path.root [ path.parent $(parent) ] $(pwd) ] ; + local our-dir = [ path.root [ path.parent $(jamfile) ] $(pwd) ] ; $(attributes).set build-dir : [ path.join $(parent-build-dir) [ path.relative $(our-dir) $(parent-dir) ] ] : exact ; } @@ -424,7 +428,7 @@ rule project-attributes ( location ) { specification = [ property.translate-paths $(specification) : $(self.location) ] ; - specification = [ property.make $(specification) ] ; + specification = [ property.make $(specification) ] ; result = [ property-set.create $(specification) ] ; # If we have inherited properties, need to refine them with the diff --git a/test/build_dir.py b/test/build_dir.py index bddac51e5..9a730f306 100644 --- a/test/build_dir.py +++ b/test/build_dir.py @@ -20,13 +20,17 @@ build-project src ; t.write("a.cpp", "int main() {}\n") t.write("src/Jamfile", "exe b : b.cpp ; ") -t.write("b.cpp", "int main() {}\n") +t.write("src/b.cpp", "int main() {}\n") t.run_build_system() t.expect_addition(["build/bin/gcc/debug/a" + exe_suffix, "build/src/bin/gcc/debug/b" + exe_suffix]) +# Test that building from child projects work +t.run_build_system(subdir='src') +t.expect_nothing_more() + # Test that project can override build dir t.write("Jamfile", """ exe a : a.cpp ;