From f5deaec1060e2fd1b4e58c3836046434a054436f Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 23 Nov 2010 07:16:28 +0000 Subject: [PATCH] Implement negative conditional requirements. For example: !single:pthread [SVN r66697] --- src/build/property.jam | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/build/property.jam b/src/build/property.jam index 1e5fbf2b7..a2ad5226b 100644 --- a/src/build/property.jam +++ b/src/build/property.jam @@ -112,12 +112,48 @@ rule evaluate-conditionals-in-context ( properties * : context * ) # Separate condition and property. local s = [ MATCH (.*):(<.*) : $(p) ] ; # Split condition into individual properties. - local c = [ regex.split $(s[1]) "," ] ; + local condition = [ regex.split $(s[1]) "," ] ; # Evaluate condition. - if $(c) in $(context) + if ! [ MATCH (!).* : $(condition:G=) ] { - result += $(s[2]) ; + # Only positive checks + if $(condition) in $(context) + { + result += $(s[2]) ; + } } + else + { + # Have negative checks + local fail ; + while $(condition) + { + local c = $(condition[1]) ; + local m = [ MATCH !(.*) : $(c) ] ; + if $(m) + { + local p = $(m:G=$(c:G)) ; + if $(p) in $(context) + { + fail = true ; + c = ; + } + } + else + { + if ! $(c) in $(context) + { + fail = true ; + c = ; + } + } + condition = $(condition[2-]) ; + } + if ! $(fail) + { + result += $(s[2]) ; + } + } } return $(result) ; }