import errors feature regex property-set ;

project condtest 
	: default-build debug
	;

local argv = [ modules.peek : ARGV ] ;

local incidental-opt ;

if --no-incidental in $(argv)
{
	echo CONFIG: Not using incidental in feature definition ;
}
else
{
	echo CONFIG: Using incidental in feature definition ;
	incidental-opt = incidental ;
}

local path-opt = [ regex.transform $(argv) : "^--path=([^ ]+)" ] ;
if "" = "$(path-opt)"
{
	path-opt = sub/dir ;
}

echo CONFIG: Using path: $(path-opt) ;

feature.feature bar-path : : $(incidental-opt) free path ;

rule bar ( properties * )
{
	local ps = [ property-set.create $(properties) ] ;
	
	if ! [ $(ps).get <bar-path> ]
	{
		errors.error "ERROR: bar-path is REALLY needed!!!" ;
	}
}

lib foo
	: # sources
	: # requirements
	<bar-path>$(path-opt)
	<conditional>@bar
	;