]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/python |
2 | ||
3 | # Copyright 2003 Dave Abrahams | |
4 | # Copyright 2002, 2003, 2004 Vladimir Prus | |
5 | # Distributed under the Boost Software License, Version 1.0. | |
6 | # (See accompanying file LICENSE_1_0.txt or copy at | |
7 | # http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | # Test conditional properties. | |
10 | ||
11 | import BoostBuild | |
12 | ||
13 | t = BoostBuild.Tester(use_test_config=False) | |
14 | ||
15 | # Arrange a project which will build only if 'a.cpp' is compiled with "STATIC" | |
16 | # define. | |
17 | t.write("a.cpp", """\ | |
18 | #ifdef STATIC | |
19 | int main() {} | |
20 | #endif | |
21 | """) | |
22 | ||
23 | # Test conditionals in target requirements. | |
24 | t.write("jamroot.jam", "exe a : a.cpp : <link>static:<define>STATIC ;") | |
25 | t.run_build_system(["link=static"]) | |
b32b8144 | 26 | t.expect_addition("bin/$toolset/debug/link-static*/a.exe") |
7c673cae FG |
27 | t.rm("bin") |
28 | ||
29 | # Test conditionals in project requirements. | |
30 | t.write("jamroot.jam", """ | |
31 | project : requirements <link>static:<define>STATIC ; | |
32 | exe a : a.cpp ; | |
33 | """) | |
34 | t.run_build_system(["link=static"]) | |
b32b8144 | 35 | t.expect_addition("bin/$toolset/debug/link-static*/a.exe") |
7c673cae FG |
36 | t.rm("bin") |
37 | ||
38 | # Regression test for a bug found by Ali Azarbayejani. Conditionals inside | |
39 | # usage requirement were not being evaluated. | |
40 | t.write("jamroot.jam", """ | |
41 | lib l : l.cpp : : : <link>static:<define>STATIC ; | |
42 | exe a : a.cpp l ; | |
43 | """) | |
44 | t.write("l.cpp", "int i;") | |
45 | t.run_build_system(["link=static"]) | |
b32b8144 | 46 | t.expect_addition("bin/$toolset/debug/link-static*/a.exe") |
7c673cae FG |
47 | |
48 | t.cleanup() |