Supports building gtest as a DLL (by Vlad Losev).

This commit is contained in:
zhanyong.wan
2009-12-18 05:23:04 +00:00
parent 88e97c822c
commit a3dd9d97c5
7 changed files with 834 additions and 2 deletions

View File

@@ -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')