default_features.py 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/python
  2. # Copyright 2003 Vladimir Prus
  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 that features with default values are always present in build properties
  6. # of any target.
  7. import BoostBuild
  8. t = BoostBuild.Tester(use_test_config=False)
  9. # Declare *non-propagated* feature foo.
  10. t.write("jamroot.jam", """
  11. import feature : feature ;
  12. feature foo : on off ;
  13. """)
  14. # Note that '<foo>on' will not be propagated to 'd/l'.
  15. t.write("jamfile.jam", """
  16. exe hello : hello.cpp d//l ;
  17. """)
  18. t.write("hello.cpp", """
  19. #ifdef _WIN32
  20. __declspec(dllimport)
  21. #endif
  22. void foo();
  23. int main() { foo(); }
  24. """)
  25. t.write("d/jamfile.jam", """
  26. lib l : l.cpp : <foo>on:<define>FOO ;
  27. """)
  28. t.write("d/l.cpp", """
  29. #ifdef _WIN32
  30. __declspec(dllexport)
  31. #endif
  32. #ifdef FOO
  33. void foo() {}
  34. #endif
  35. """)
  36. t.run_build_system()
  37. t.expect_addition("bin/$toolset/debug*/hello.exe")
  38. t.cleanup()