site_scons: added option to overwrite TEST_EXTRA_LIBS in BoostUnitTest target
[senf.git] / site_scons / site_tools / Boost.py
index 629dd3e..d040b78 100644 (file)
@@ -88,7 +88,7 @@ def BoostUnitTest(env, target=None, source=None,  **kw):
     stampnode = target.dir.File('.' + target.name + '.stamp')
 
     bin = env.Program(binnode, source,
-                      LIBS = env['LIBS'] + [ '$TEST_EXTRA_LIBS' ],
+                      LIBS = env['LIBS'] + kw.pop('TEST_EXTRA_LIBS', ['$TEST_EXTRA_LIBS']),
                       _LIBFLAGS = ' -Wl,-Bstatic -l$BOOSTTESTLIB -Wl,-Bdynamic ' + env['_LIBFLAGS'],
                       **kw)
 
@@ -142,10 +142,14 @@ Options:
     else:
         msg = ''
     context.Message( "Checking boost version%s... " % msg )
-    ret = context.TryRun("#include <boost/version.hpp>\n"
-                         "#include <iostream>\n"
-                         "int main(int, char **) { std::cout << BOOST_LIB_VERSION << std::endl; }",
-                         ".cc")[-1].strip()
+    if context.env.has_key('BOOST_VERSION'):
+        ret = context.env['BOOST_VERSION']
+    else:
+        ret = context.TryRun("#include <boost/version.hpp>\n"
+                             "#include <iostream>\n"
+                             "int main(int, char **)\n"
+                             "{ std::cout << BOOST_LIB_VERSION << std::endl; }",
+                             ".cc")[-1].strip()
 
     if not ret:
         msg = "no boost includes found"