diff --git a/v2/test/project_glob.py b/v2/test/project_glob.py index 39ec39305..fe76b6870 100644 --- a/v2/test/project_glob.py +++ b/v2/test/project_glob.py @@ -143,5 +143,38 @@ exe a : [ glob $(pwd)/src/foo/*.cpp $(pwd)/src/bar/*.cpp ] ../d2/d//l ; t.run_build_system(subdir="d1") t.expect_addition("d1/bin/$toolset/debug/a.exe") +# Regression test: glob excludes used to be broken +# when building from a subdirectory. +t.rm(".") + +t.write("Jamroot", """ +build-project p ; +""") + +t.write("p/p.c", """ +int main() +{ + return 0; +} + + +""") + +t.write("p/p_x.c", """ +int main() +{ + return 0; +} + +""") + +t.write("p/Jamfile", """ +exe p : + [ glob *.c : p_x.c ] + ; +""") + +t.run_build_system(subdir="p") +t.expect_addition("p/bin/$toolset/debug/p.exe") t.cleanup() diff --git a/v2/util/path.jam b/v2/util/path.jam index c7fdf801d..989b5649e 100644 --- a/v2/util/path.jam +++ b/v2/util/path.jam @@ -243,7 +243,9 @@ rule glob ( dirs * : patterns + : exclude-patterns * ) } local inc = [ GLOB-RECURSIVELY $(real-patterns) ] ; + inc = [ sequence.transform NORMALIZE_PATH : $(inc) ] ; local exc = [ GLOB-RECURSIVELY $(real-exclude-patterns) ] ; + exc = [ sequence.transform NORMALIZE_PATH : $(exc) ] ; return [ sequence.transform path.make : [ set.difference $(inc) : $(exc) ] ] ;