diff --git a/src/build/targets.jam b/src/build/targets.jam index 976422c82..876bab773 100644 --- a/src/build/targets.jam +++ b/src/build/targets.jam @@ -400,7 +400,7 @@ rule basic-target ( name : project if dependency in [ feature.attributes $(p:G) ] { local g = [ generate-source $(p:G=) : $(properties) ] ; - xproperties += $(p:G)$(g) ; + xproperties += $(p:G)$(g) [ $(g).use-requirements ] ; } else { diff --git a/test/use_requirements.py b/test/use_requirements.py index f398f6c63..b4b1193ad 100644 --- a/test/use_requirements.py +++ b/test/use_requirements.py @@ -21,6 +21,25 @@ 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("project-root.jam", "import gcc ;") +t.write("Jamfile", """ + lib b : b.cpp : : : FOO ; + exe a : a.cpp : b ; +""") +t.write("b.cpp", "void foo() {}") +t.write("a.cpp", """ +#ifdef FOO +int main() {} +#endif +""") + +t.run_build_system() + +t.run_build_system("--clean") + + # Test that use requirement on project work t.write("Jamfile", "exe a : a.cpp lib/b ;") t.write("lib/Jamfile", """