Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/build/v2/test/conditionals.py @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.3 KB
Line 
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 http://www.boost.org/LICENSE_1_0.txt)
7
8# Test conditional properties
9
10from BoostBuild import Tester, List
11import os
12from string import strip
13
14t = Tester()
15
16# Arrange a project which will build only if
17# 'a.cpp' is compiled with "STATIC" define.
18t.write("project-root.jam", "import gcc ;")
19t.write("a.cpp", """
20#ifdef STATIC
21int main() {  return 0; }
22#endif
23""")
24t.write("Jamfile", "exe a : a.cpp : <link>static:<define>STATIC ;")
25t.run_build_system("link=static")
26t.expect_addition("bin/$toolset/debug/link-static/a.exe")
27
28t.write("Jamfile", """
29project : requirements <link>static:<define>STATIC ;
30exe a : a.cpp ;
31""")
32t.rm("bin")
33t.run_build_system("link=static")
34t.expect_addition("bin/$toolset/debug/link-static/a.exe")
35
36# Regression test for a bug found by Ali Azarbayejani.
37# Conditionals inside usage requirement were not evaluated.
38# This breaks
39
40t.write("Jamfile", """
41lib l : l.cpp : : : <link>static:<define>STATIC ;
42exe a : a.cpp l ;
43""")
44t.write("l.cpp", "")
45t.write("l.cpp", """
46int i;
47""")
48
49t.rm("bin")
50t.run_build_system("link=static")
51t.expect_addition("bin/$toolset/debug/link-static/a.exe")
52
53
54
55t.cleanup()
Note: See TracBrowser for help on using the repository browser.