1#!/usr/local/bin/python3.8
2
3# Copyright 2020 Nikita Kniazev
4# Distributed under the Boost Software License, Version 1.0.
5# (See accompanying file LICENSE_1_0.txt or copy at
6# http://www.boost.org/LICENSE_1_0.txt)
7
8# Tests the force-include feature
9
10import BoostBuild
11
12t = BoostBuild.Tester(use_test_config=False)
13
14t.write("Jamroot.jam", """
15obj test-cpp : test.cpp : <force-include>one.h <force-include>two.h ;
16obj test-c : test.c : <force-include>one.h <force-include>two.h ;
17""")
18
19for name in ("test.cpp", "test.c"):
20    t.write(name, """
21#ifndef ONE
22#error Cannot compile without ONE
23#endif
24#ifndef TWO
25#error Cannot compile without TWO
26#endif
27""")
28
29t.write("one.h", """
30#define ONE
31""")
32
33t.write("two.h", """
34#define TWO
35""")
36
37t.run_build_system()
38t.expect_addition("bin/$toolset/debug*/test-cpp.obj")
39t.expect_addition("bin/$toolset/debug*/test-c.obj")
40
41t.cleanup()
42