1#!/usr/local/bin/python3.8 2 3# Copyright 2003, 2006 Vladimir Prus 4# Distributed under the Boost Software License, Version 1.0. 5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 7import BoostBuild 8 9t = BoostBuild.Tester(use_test_config=False) 10 11t.write("jamroot.jam", """\ 12project : requirements <link>static ; 13exe a : a.cpp [ lib helper : helper.cpp ] ; 14""") 15 16t.write("a.cpp", """\ 17extern void helper(); 18int main() {} 19""") 20 21t.write("helper.cpp", "void helper() {}\n") 22 23t.run_build_system() 24t.expect_addition("bin/$toolset/debug*/a__helper.lib") 25t.rm("bin/$toolset/debug*/a__helper.lib") 26 27t.run_build_system(["a__helper"]) 28t.expect_addition("bin/$toolset/debug*/a__helper.lib") 29 30t.rm("bin") 31 32 33# Now check that inline targets with the same name but present in different 34# places are not confused between each other, and with top-level targets. 35t.write("jamroot.jam", """\ 36project : requirements <link>static ; 37exe a : a.cpp [ lib helper : helper.cpp ] ; 38exe a2 : a.cpp [ lib helper : helper.cpp ] ; 39""") 40 41t.run_build_system() 42t.expect_addition("bin/$toolset/debug/link-static*/a.exe") 43t.expect_addition("bin/$toolset/debug*/a__helper.lib") 44t.expect_addition("bin/$toolset/debug*/a2__helper.lib") 45 46 47# Check that the 'alias' target does not change the name of inline targets, and 48# that inline targets are explicit. 49t.write("jamroot.jam", """\ 50project : requirements <link>static ; 51alias a : [ lib helper : helper.cpp ] ; 52explicit a ; 53""") 54t.rm("bin") 55 56t.run_build_system() 57t.expect_nothing_more() 58 59t.run_build_system(["a"]) 60t.expect_addition("bin/$toolset/debug*/helper.lib") 61 62t.cleanup() 63