conditionals4.py 881 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/python
  2. # Copyright 2021 Dmitry Arkhipov (grisumbras@gmail.com)
  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 conditionals returning conditionals
  6. import BoostBuild
  7. t = BoostBuild.Tester()
  8. t.write("a.cpp", "")
  9. t.write("jamroot.jam", """
  10. import feature ;
  11. import common ;
  12. feature.feature the_feature : false true : propagated ;
  13. rule add-feature ( properties * )
  14. {
  15. return <the_feature>true ;
  16. }
  17. rule maker ( targets * : sources * : properties * )
  18. {
  19. if ! <the_feature>true in $(properties)
  20. {
  21. EXIT "Need <the_feature>true to build" ;
  22. }
  23. CMD on $(targets) = [ common.file-creation-command ] ;
  24. }
  25. actions maker
  26. {
  27. $(CMD) $(<) ;
  28. }
  29. make a : a.cpp : maker : <variant>debug:<conditional>@add-feature ;
  30. """)
  31. t.run_build_system()
  32. t.cleanup()