feature_cxxflags.py 784 B

12345678910111213141516171819202122232425262728293031323334353637
  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 copy at
  5. # https://www.bfgroup.xyz/b2/LICENSE.txt)
  6. # Tests the cxxflags feature
  7. import BoostBuild
  8. t = BoostBuild.Tester(use_test_config=False)
  9. # cxxflags should be applied to C++ compilation,
  10. # but not to C.
  11. t.write("Jamroot.jam", """
  12. obj test-cpp : test.cpp : <cxxflags>-DOKAY ;
  13. obj test-c : test.c : <cxxflags>-DBAD ;
  14. """)
  15. t.write("test.cpp", """
  16. #ifndef OKAY
  17. #error Cannot compile without OKAY
  18. #endif
  19. """)
  20. t.write("test.c", """
  21. #ifdef BAD
  22. #error Cannot compile with BAD
  23. #endif
  24. """)
  25. t.run_build_system()
  26. t.expect_addition("bin/$toolset/debug*/test-cpp.obj")
  27. t.expect_addition("bin/$toolset/debug*/test-c.obj")
  28. t.cleanup()