1#!/usr/local/bin/python3.8 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 11import BoostBuild 12 13t = BoostBuild.Tester(use_test_config=False) 14 15# Arrange a project which will build only if 'a.cpp' is compiled with "STATIC" 16# define. 17t.write("a.cpp", """\ 18#ifdef STATIC 19int main() {} 20#endif 21""") 22 23# Test conditionals in target requirements. 24t.write("jamroot.jam", "exe a : a.cpp : <link>static:<define>STATIC ;") 25t.run_build_system(["link=static"]) 26t.expect_addition("bin/$toolset/debug/link-static*/a.exe") 27t.rm("bin") 28 29# Test conditionals in project requirements. 30t.write("jamroot.jam", """ 31project : requirements <link>static:<define>STATIC ; 32exe a : a.cpp ; 33""") 34t.run_build_system(["link=static"]) 35t.expect_addition("bin/$toolset/debug/link-static*/a.exe") 36t.rm("bin") 37 38# Regression test for a bug found by Ali Azarbayejani. Conditionals inside 39# usage requirement were not being evaluated. 40t.write("jamroot.jam", """ 41lib l : l.cpp : : : <link>static:<define>STATIC ; 42exe a : a.cpp l ; 43""") 44t.write("l.cpp", "int i;") 45t.run_build_system(["link=static"]) 46t.expect_addition("bin/$toolset/debug/link-static*/a.exe") 47 48t.cleanup() 49