library_property.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/python
  2. # Copyright 2004 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 the <library> property has no effect on "obj" targets. Previously,
  6. # it affected all targets, so
  7. #
  8. # project : requirements <library>foo ;
  9. # exe a : a.cpp helper ;
  10. # obj helper : helper.cpp : <optimization>off ;
  11. #
  12. # caused 'foo' to be built with and without optimization.
  13. import BoostBuild
  14. t = BoostBuild.Tester(use_test_config=False)
  15. t.write("jamroot.jam", """
  16. project : requirements <library>lib//x ;
  17. exe a : a.cpp foo ;
  18. obj foo : foo.cpp : <variant>release ;
  19. """)
  20. t.write("a.cpp", """
  21. void aux();
  22. int main() { aux(); }
  23. """)
  24. t.write("foo.cpp", """
  25. void gee();
  26. void aux() { gee(); }
  27. """)
  28. t.write("lib/x.cpp", """
  29. void
  30. #if defined(_WIN32)
  31. __declspec(dllexport)
  32. #endif
  33. gee() {}
  34. """)
  35. t.write("lib/jamfile.jam", """
  36. lib x : x.cpp ;
  37. """)
  38. t.write("lib/jamroot.jam", """
  39. """)
  40. t.run_build_system()
  41. t.expect_addition("bin/$toolset/debug*/a.exe")
  42. t.expect_nothing("lib/bin/$toolset/release/x.obj")
  43. t.cleanup()