diff --git a/v2/build/project.jam b/v2/build/project.jam index 735636a85..a1d669477 100644 --- a/v2/build/project.jam +++ b/v2/build/project.jam @@ -601,8 +601,29 @@ module project-rules import project ; local location = [ project.attribute $(__name__) source-location ] ; - local all-paths = [ path.glob $(location) : $(wildcards) ] ; - return $(all-paths:D="") ; + + local all-paths ; + if ! $(wildcards:D) + { + # No directory in any wildcard -- the simplest case. + all-paths = [ path.glob $(location) : $(wildcards) ] ; + all-paths = $(all-paths:D="") ; + } + else + { + for local w in $(wildcards) + { + local l = [ path.join $(location) $(w:D) ] ; + local paths = [ path.glob $(l) : $(w:D="") ] ; + for local p in $(paths) + { + all-paths += [ path.relative $(p) $(location) ] ; + } + } + + } + + return $(all-paths) ; } } diff --git a/v2/test/glob.py b/v2/test/glob.py index cd8f67544..aaf400e87 100644 --- a/v2/test/glob.py +++ b/v2/test/glob.py @@ -62,5 +62,30 @@ exe a : [ glob *.cpp ] ../d2/d//l ; t.run_build_system(subdir="d1") t.expect_addition("d1/bin/$toolset/debug/a.exe") +# Test that wildcards can include directories +t.rm("d1") + +t.write("d1/src/foo/a.cpp", """ +void bar(); +int main() { bar(); return 0; } + +""") + +t.write("d1/src/bar/b.cpp", """ +void bar() {} + +""") + + +t.write("d1/Jamfile", """ +project : source-location src ; +exe a : [ glob foo/*.cpp bar/*.cpp ] ../d2/d//l ; +""") + +t.run_build_system(subdir="d1") +t.expect_addition("d1/bin/$toolset/debug/a.exe") + + + t.cleanup()