c_file.py 682 B

123456789101112131415161718192021222324252627282930313233343536
  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 C files are compiled by a C compiler.
  6. import BoostBuild
  7. t = BoostBuild.Tester(use_test_config=False)
  8. t.write("jamroot.jam", """
  9. project ;
  10. exe hello : hello.cpp a.c ;
  11. """)
  12. t.write("hello.cpp", """
  13. extern "C" int foo();
  14. int main() { return foo(); }
  15. """)
  16. t.write("a.c", """
  17. // This will not compile unless in C mode.
  18. int foo()
  19. {
  20. int new = 0;
  21. new = (new+1)*7;
  22. return new;
  23. }
  24. """)
  25. t.run_build_system()
  26. t.expect_addition("bin/$toolset/debug*/hello.exe")
  27. t.cleanup()