aboutsummaryrefslogtreecommitdiffstats
path: root/scons/SConscript.common
diff options
context:
space:
mode:
Diffstat (limited to 'scons/SConscript.common')
-rw-r--r--scons/SConscript.common18
1 files changed, 18 insertions, 0 deletions
diff --git a/scons/SConscript.common b/scons/SConscript.common
index 7fda32e1..7943e77c 100644
--- a/scons/SConscript.common
+++ b/scons/SConscript.common
@@ -132,6 +132,24 @@ class EnvCreator:
env.Append(CPPDEFINES='GTEST_HAS_RTTI=0')
NoRtti = classmethod(NoRtti)
+ def DllBuild(cls, env):
+ """Enables building gtets as a DLL."""
+
+ env['OBJ_SUFFIX'] = '_dll'
+ # -MT(d) instructs MSVC to link to the static version of the C++
+ # runtime library; -MD(d) tells it to link to the DLL version.
+ flags = env['CCFLAGS']
+ if '-MTd' in flags:
+ flags.remove('-MTd')
+ flags.append('-MDd')
+ elif '-MT' in flags:
+ flags.remove('-MT')
+ flags.append('-MD')
+
+ # Disables the "non dll-interface class 'stdext::exception' used as
+ # base for dll-interface class" warning triggered by the STL code.
+ env.Append(CCFLAGS=['/wd4275'])
+ DllBuild = classmethod(DllBuild)
sconscript_exports = {'EnvCreator': EnvCreator}
Return('sconscript_exports')