1#!/usr/local/bin/python3.8
2
3# Copyright 2014 Steven Watanabe
4# Distributed under the Boost Software License, Version 1.0.
5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7# Test the handling of toolset.add-requirements
8
9import BoostBuild
10
11t = BoostBuild.Tester(pass_toolset=0, ignore_toolset_requirements=False)
12
13t.write('jamroot.jam', '''
14import toolset ;
15import errors ;
16
17rule test-rule ( properties * )
18{
19  return <define>TEST_INDIRECT_CONDITIONAL ;
20}
21
22toolset.add-requirements
23  <define>TEST_MACRO
24  <conditional>@test-rule
25  <link>shared:<define>TEST_CONDITIONAL
26;
27
28rule check-requirements ( target : sources * : properties * )
29{
30  local macros = TEST_MACRO TEST_CONDITIONAL TEST_INDIRECT_CONDITIONAL ;
31  for local m in $(macros)
32  {
33    if ! <define>$(m) in $(properties)
34    {
35      errors.error $(m) not defined ;
36    }
37  }
38}
39make test : : @check-requirements ;
40''')
41
42t.run_build_system()
43
44t.cleanup()
45