Solution for #948 : special treatment for the test-suite

Note: this changeset globally sets the linkerflag --as-needed
but adds a single, hard coded exception to this rule for
taget/test-suite
This commit is contained in:
Fischlurch 2014-09-30 04:40:24 +02:00
parent 9945351ab2
commit 4e5b1901a1
2 changed files with 9 additions and 1 deletions

View file

@ -78,6 +78,7 @@ def defineBuildEnvironment():
, CFLAGS='-std=gnu99'
)
env.Append(LINKFLAGS='-Wl,--no-undefined') # require every dependency is given on link, in the right order
env.Append(LINKFLAGS='-Wl,--as-needed') # by default only link against dependencies actually needed to resolve symbols
handleVerboseMessages(env)
handleNoBugSwitches(env)

View file

@ -62,6 +62,13 @@ def testCases(env,dir):
# Specific linker treatment for the testsuite:
# force explicit linking against all dependencies to ensure auto-registration of
# any test-class on startup, even if no code dependency is visible to the linker
envSuite = env.Clone()
envSuite.Append(LINKFLAGS='-Wl,--no-as-needed')
# have to treat some subdirs separately.
specialDirs = ['plugin','tool','include']
testSrcDirs = globRootdirs('*')
@ -69,7 +76,7 @@ testSrcDirs = globRootdirs('*')
testcases = [testCases(env, dir) for dir in testSrcDirs if not dir in specialDirs]
testLibs = sharedTestLibs.values()
testrunner = env.Program("test-suite", ["testrunner.cpp"]+testLibs+core_lib)
testrunner = envSuite.Program("test-suite", ["testrunner.cpp"]+testLibs+core_lib)
testsuite = ( testcases