#!/usr/bin/python
# Copyright 2003 Dave Abrahams
# Copyright 2002, 2003, 2004, 2006 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)
import BoostBuild
t = BoostBuild.Tester()
# Test that use requirements on main target work (and a propagated all the way
# up, not only to direct dependants).
t.write("jamroot.jam", "import gcc ;")
# Note: 'lib cc ..', not 'lib c'. If using 'lib c: ...' the HP-CXX linker will
# confuse it with the system C runtime.
t.write("jamfile.jam", """
lib b : b.cpp : shared:SHARED_B : :
FOO shared:SHARED_B ;
lib cc : c.cpp b ;
exe a : a.cpp cc ;
""")
t.write("b.cpp", """
void
#if defined(_WIN32) && defined(SHARED_B)
__declspec(dllexport)
#endif
foo() {}\n
""")
t.write("c.cpp", """
void
#if defined(_WIN32) && defined(SHARED_B)
__declspec(dllexport)
#endif
create_lib_please() {}\n
""")
t.write("a.cpp", """
#ifdef FOO
void
# if defined(_WIN32) && defined(SHARED_B)
__declspec(dllexport)
# endif
foo() {}
#endif
int main() { foo(); }
""")
t.run_build_system()
t.run_build_system("--clean")
# Test that use requirements on main target work, when they are referred using
# 'dependency' features.
t.write("jamroot.jam", "import gcc ;")
t.write("jamfile.jam", """
lib b : b.cpp : shared:SHARED_B : : FOO
shared:SHARED_B ;
exe a : a.cpp :