relative_sources.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/python
  2. # Copyright 2003 Dave Abrahams
  3. # Copyright 2002, 2006 Vladimir Prus
  4. # Distributed under the Boost Software License, Version 1.0.
  5. # (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
  6. # Test that we can specify sources using relative names.
  7. import BoostBuild
  8. t = BoostBuild.Tester(use_test_config=False)
  9. # Test that relative path to source, 'src', is preserved.
  10. t.write("jamroot.jam", "exe a : src/a.cpp ;")
  11. t.write("src/a.cpp", "int main() {}\n")
  12. t.run_build_system()
  13. t.expect_addition("bin/$toolset/debug*/src/a.obj")
  14. # Test that the relative path to source is preserved
  15. # when using 'glob'.
  16. t.rm("bin")
  17. t.write("jamroot.jam", "exe a : [ glob src/*.cpp ] ;")
  18. t.run_build_system()
  19. t.expect_addition("bin/$toolset/debug*/src/a.obj")
  20. # Test that relative path with ".." is *not* added to
  21. # target path.
  22. t.rm(".")
  23. t.write("jamroot.jam", "")
  24. t.write("a.cpp", "int main() { return 0; }\n")
  25. t.write("build/Jamfile", "exe a : ../a.cpp ; ")
  26. t.run_build_system(subdir="build")
  27. t.expect_addition("build/bin/$toolset/debug*/a.obj")
  28. t.cleanup()