diff --git a/v2/build/targets.jam b/v2/build/targets.jam index 86b6e73f8..ad039d7cf 100644 --- a/v2/build/targets.jam +++ b/v2/build/targets.jam @@ -582,7 +582,6 @@ rule find ( id : project ) local target-part = $(split[2]) ; if ! $(split) { - project-part = . ; target-part = $(id) ; } @@ -591,7 +590,18 @@ rule find ( id : project ) # The project used for finding main targets and for providing base directory # for file paths. - local base-project = [ project.find $(project-part) : $(current-location) ] ; + local base-project ; + if $(project-part) + { + base-project = [ project.find $(project-part) : $(current-location) ] ; + } + else + { + # No project part in id. Resolve references relatively to the referring + # project. + base-project = $(project) ; + } + # Interpret target-part as project-id if ! $(have-project-reference) diff --git a/v2/test/standalone.py b/v2/test/standalone.py new file mode 100644 index 000000000..94e62593a --- /dev/null +++ b/v2/test/standalone.py @@ -0,0 +1,48 @@ +#!/usr/bin/python + +# Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and +# distribute this software is granted provided this copyright notice appears in +# all copies. This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + + +from BoostBuild import Tester, List + +t = Tester() + +# Regression tests: standalone project were not able to refer to targets +# declared in themselfs! + +t.write("a.cpp", """ +int main() +{ + return 0; +} + +""") + +t.write("project-root.jam", """ +import standalone ; +""") + +t.write("standalone.jam", """ +import project ; + +project.initialize $(__name__) ; +project standalone ; + +local pwd = [ PWD ] ; + +alias x : $(pwd)/../a.cpp ; +alias runtime : x ; + +""") + +t.write("sub/Jamfile", """ +stage bin : /standalone//runtime ; +""") + +t.run_build_system(subdir="sub") +t.expect_addition("sub/bin/a.cpp") +t.cleanup() + diff --git a/v2/test/test_all.py b/v2/test/test_all.py index 7a69c7720..d09985a81 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -113,6 +113,7 @@ tests = [ "project_test1", "composite", "library_chain", "unit_test", + "standalone", ] if os.name == 'posix':