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

Fix configure.choose when none of the targets build successfully. Refs #295.

This commit is contained in:
Steven Watanabe
2018-04-04 17:33:24 -06:00
parent c9a2deb416
commit 7ea55e4f2d
2 changed files with 33 additions and 0 deletions

View File

@@ -276,6 +276,10 @@ rule try-find-build ( ps : what : * )
local x = [ PAD " - $(what)" : $(.width) ] ;
for local i in $(args)
{
if ! $($(i)[1])
{
break ;
}
local jam-targets ;
for local t in $($(i)[2-])
{
@@ -291,6 +295,7 @@ rule try-find-build ( ps : what : * )
}
if ! $(result)
{
log-check-result "$(x) : none" ;
result = none ;
}
}

View File

@@ -187,5 +187,33 @@ obj foo : foo.cpp :
t.cleanup()
def test_choose_none():
"""Tests choose when none of the alternatives match."""
t = BoostBuild.Tester(use_test_config=0)
t.write("Jamroot", """
import configure ;
obj fail : fail.cpp ;
explicit pass fail ;
obj foo : foo.cpp :
[ configure.choose "which one?" : fail <define>FAIL ] ;
""")
t.write("fail.cpp", "#error fail.cpp\n")
t.write("foo.cpp", """
#ifdef FAIL
#error FAIL is defined
#endif
""")
t.run_build_system()
t.expect_output_lines([
" - which one? : none"])
# An up-to-date build should use the cache
t.run_build_system()
t.expect_output_lines([
" - which one? : none (cached)"])
t.expect_nothing_more()
t.cleanup()
test_check_target_builds()
test_choose()
test_choose_none()