2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00

Allow directory names in arguments in 'glob'.

[SVN r22800]
This commit is contained in:
Vladimir Prus
2004-05-12 08:50:04 +00:00
parent 4235d88e10
commit b4da2e146b
2 changed files with 48 additions and 2 deletions

View File

@@ -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) ;
}
}

View File

@@ -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()