toolset_requirements.py 933 B

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