summaryrefslogtreecommitdiff
path: root/tools/build/test/default_features.py
blob: 0d285a3f9d3408395645915e63d2599b4580acec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/python

# Copyright 2003 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

# Test that features with default values are always present in build properties
# of any target.

import BoostBuild

t = BoostBuild.Tester(use_test_config=False)

# Declare *non-propagated* feature foo.
t.write("jamroot.jam", """
import feature : feature ;
feature foo : on off ;
""")

# Note that '<foo>on' will not be propagated to 'd/l'.
t.write("jamfile.jam", """
exe hello : hello.cpp d//l ;
""")

t.write("hello.cpp", """
#ifdef _WIN32
__declspec(dllimport)
#endif
void foo();
int main() { foo(); }
""")

t.write("d/jamfile.jam", """
lib l : l.cpp : <foo>on:<define>FOO ;
""")

t.write("d/l.cpp", """
#ifdef _WIN32
__declspec(dllexport)
#endif
#ifdef FOO
void foo() {}
#endif
""")

t.run_build_system()

t.expect_addition("bin/$toolset/debug/hello.exe")

t.cleanup()