mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 13:02:11 +00:00
Ignore <library>, except for "exe" and "lib" targets.
[SVN r25661]
This commit is contained in:
@@ -1008,9 +1008,9 @@ class basic-target : abstract-target
|
||||
$(usage-requirements) ] ;
|
||||
usage-requirements = [ property-set.create $(usage-requirements) ] ;
|
||||
|
||||
local libs = [ $(rproperties).get <library> ] ;
|
||||
libs += [ $(rproperties).get <source> ] ;
|
||||
source-targets += $(libs:G=) ;
|
||||
local extra = [ $(rproperties).get <source> ] ;
|
||||
extra += [ extra-sources $(rproperties) ] ;
|
||||
source-targets += $(extra:G=) ;
|
||||
# We might get duplicate sources, for example if
|
||||
# we link to two library which have the same <library> in
|
||||
# usage requirements.
|
||||
@@ -1125,6 +1125,13 @@ class basic-target : abstract-target
|
||||
{
|
||||
errors.error "method should be defined in derived classes" ;
|
||||
}
|
||||
|
||||
# Returns extra targets which must be added to the list of sources
|
||||
# used for building. Mainly, a hook for <library> property.
|
||||
rule extra-sources ( property-set )
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class typed-target : basic-target
|
||||
|
||||
63
v2/test/library_property.py
Normal file
63
v2/test/library_property.py
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) Vladimir Prus 2004. Permission to copy, use, modify, sell and
|
||||
# distribute this software is granted provided this copyright notice appears in
|
||||
# all copies. This software is provided "as is" without express or implied
|
||||
# warranty, and with no claim as to its suitability for any purpose.
|
||||
|
||||
# Test that the <library> property has no effect on "obj" targets.
|
||||
# Previously, it affected all targets, so
|
||||
#
|
||||
# project : requirements <library>foo ;
|
||||
# exe a : a.cpp helper ;
|
||||
# obj helper : helper.cpp : <optimization>off ;
|
||||
#
|
||||
# caused 'foo' to be built with with and without optimization.
|
||||
from BoostBuild import Tester, List
|
||||
|
||||
# Create a temporary working directory
|
||||
t = Tester()
|
||||
|
||||
t.write("Jamfile", """
|
||||
project
|
||||
: requirements <library>lib//x
|
||||
;
|
||||
exe a : a.cpp foo ;
|
||||
obj foo : foo.cpp : <variant>release ;
|
||||
""")
|
||||
|
||||
t.write("a.cpp", """
|
||||
void aux();
|
||||
int main() { aux(); }
|
||||
""")
|
||||
|
||||
t.write("foo.cpp", """
|
||||
void gee();
|
||||
void aux() { gee(); }
|
||||
""")
|
||||
|
||||
t.write("project-root.jam", """
|
||||
""")
|
||||
|
||||
t.write("lib/x.cpp", """
|
||||
void
|
||||
#if defined(_WIN32)
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
gee() {}
|
||||
""")
|
||||
|
||||
t.write("lib/Jamfile", """
|
||||
lib x : x.cpp ;
|
||||
""")
|
||||
|
||||
t.write("lib/project-root.jam", """
|
||||
""")
|
||||
|
||||
|
||||
t.run_build_system()
|
||||
t.expect_addition("bin/$toolset/debug/a.exe")
|
||||
t.expect_nothing("lib/bin/$toolset/release/x.obj")
|
||||
t.cleanup()
|
||||
|
||||
|
||||
@@ -123,6 +123,7 @@ tests = [ "project_test1",
|
||||
"expansion",
|
||||
"wrapper",
|
||||
"duplicate",
|
||||
"library_property",
|
||||
#"ordered_properties",
|
||||
]
|
||||
|
||||
|
||||
@@ -429,6 +429,12 @@ class lib-target-class : basic-target
|
||||
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
rule extra-sources ( property-set )
|
||||
{
|
||||
return [ $(property-set).get <library> ] ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rule lib ( names + : sources * : requirements * : default-build *
|
||||
@@ -521,7 +527,10 @@ class exe-target-class : typed-target
|
||||
basic-target.check-for-unused-sources $(result) : $(sources-to-check) ;
|
||||
}
|
||||
|
||||
|
||||
rule extra-sources ( property-set )
|
||||
{
|
||||
return [ $(property-set).get <library> ] ;
|
||||
}
|
||||
}
|
||||
|
||||
rule exe ( name : sources * : requirements * : default-build *
|
||||
|
||||
Reference in New Issue
Block a user