diff --git a/new/property.jam b/new/property.jam index 05897b440..602218888 100644 --- a/new/property.jam +++ b/new/property.jam @@ -114,7 +114,7 @@ rule evaluate-conditionals-in-context ( properties * : context * ) for local p in $(conditionals) { # Separate condition and property - local s = [ MATCH (.*):(.*) : $(p) ] ; + local s = [ MATCH ([^:]*):(.*) : $(p) ] ; # Split condition into individual properties local c = [ regex.split $(s[1]) "," ] ; # Evaluate condition diff --git a/test/conditionals3.py b/test/conditionals3.py new file mode 100644 index 000000000..c4b067dd0 --- /dev/null +++ b/test/conditionals3.py @@ -0,0 +1,34 @@ +#!/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. + +# Test that conditional properties work, even if property is free, and +# value includes colon. +from BoostBuild import Tester, List + + +t = Tester() + +# Create the needed files +t.write("project-root.jam", "") +t.write("Jamfile", """ +exe hello : hello.cpp : debug:CLASS=Foo::Bar ; +""") +t.write("hello.cpp", """ +namespace Foo { class Bar { } ; } +int main() +{ + CLASS c; + return 0; +} + +""") + +# Don't check stderr, which can include warning about unused 'c'. +t.run_build_system(stderr=None) +t.expect_addition("bin/$toolset/debug/main-target-hello/hello") + +t.cleanup() diff --git a/test/test_all.py b/test/test_all.py index 71aab124b..c30dfc97b 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -101,6 +101,7 @@ tests = [ "project_test1", "conditionals2", "property_expansion", "loop", + "conditionals3", ] if os.name == 'posix': diff --git a/v2/build/property.jam b/v2/build/property.jam index 05897b440..602218888 100644 --- a/v2/build/property.jam +++ b/v2/build/property.jam @@ -114,7 +114,7 @@ rule evaluate-conditionals-in-context ( properties * : context * ) for local p in $(conditionals) { # Separate condition and property - local s = [ MATCH (.*):(.*) : $(p) ] ; + local s = [ MATCH ([^:]*):(.*) : $(p) ] ; # Split condition into individual properties local c = [ regex.split $(s[1]) "," ] ; # Evaluate condition diff --git a/v2/test/conditionals3.py b/v2/test/conditionals3.py new file mode 100644 index 000000000..c4b067dd0 --- /dev/null +++ b/v2/test/conditionals3.py @@ -0,0 +1,34 @@ +#!/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. + +# Test that conditional properties work, even if property is free, and +# value includes colon. +from BoostBuild import Tester, List + + +t = Tester() + +# Create the needed files +t.write("project-root.jam", "") +t.write("Jamfile", """ +exe hello : hello.cpp : debug:CLASS=Foo::Bar ; +""") +t.write("hello.cpp", """ +namespace Foo { class Bar { } ; } +int main() +{ + CLASS c; + return 0; +} + +""") + +# Don't check stderr, which can include warning about unused 'c'. +t.run_build_system(stderr=None) +t.expect_addition("bin/$toolset/debug/main-target-hello/hello") + +t.cleanup() diff --git a/v2/test/test_all.py b/v2/test/test_all.py index 71aab124b..c30dfc97b 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -101,6 +101,7 @@ tests = [ "project_test1", "conditionals2", "property_expansion", "loop", + "conditionals3", ] if os.name == 'posix':