1#!/usr/local/bin/python3.8 2 3# Copyright (C) Vladimir Prus 2006. 4# Distributed under the Boost Software License, Version 1.0. (See 5# accompanying file LICENSE_1_0.txt or copy at 6# http://www.boost.org/LICENSE_1_0.txt) 7 8# Test the <implicit-dependency> is respected even if the target referred to is 9# not built itself, but only referred to by <implicit-dependency>. 10 11import BoostBuild 12 13t = BoostBuild.Tester(use_test_config=False) 14 15t.write("jamroot.jam", """ 16make a.h : : gen-header ; 17explicit a.h ; 18 19exe hello : hello.cpp : <implicit-dependency>a.h ; 20 21import os ; 22if [ os.name ] = NT 23{ 24 actions gen-header 25 { 26 echo int i; > $(<) 27 } 28} 29else 30{ 31 actions gen-header 32 { 33 echo "int i;" > $(<) 34 } 35} 36""") 37 38t.write("hello.cpp", """ 39#include "a.h" 40int main() { return i; } 41""") 42 43 44t.run_build_system() 45 46t.expect_addition("bin/$toolset/debug*/hello.exe") 47 48t.rm("bin") 49 50t.write("jamroot.jam", """ 51make dir/a.h : : gen-header ; 52explicit dir/a.h ; 53 54exe hello : hello.cpp : <implicit-dependency>dir/a.h ; 55 56import os ; 57if [ os.name ] = NT 58{ 59 actions gen-header 60 { 61 echo int i; > $(<) 62 } 63} 64else 65{ 66 actions gen-header 67 { 68 echo "int i;" > $(<) 69 } 70} 71""") 72 73t.write("hello.cpp", """ 74#include "dir/a.h" 75int main() { return i; } 76""") 77t.run_build_system() 78 79t.expect_addition("bin/$toolset/debug*/hello.exe") 80 81t.cleanup() 82