aboutsummaryrefslogtreecommitdiffstats
path: root/scons/SConscript.common
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-12-18 05:23:04 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-12-18 05:23:04 +0000
commita3dd9d97c57eb1be851a27ffcd6edaed69ee816e (patch)
tree1b0ba9ecfc2d495d6c293110c6331a77304e35e1 /scons/SConscript.common
parent88e97c822c988eaa9f8bcbaa1ea5d702ffd7d384 (diff)
downloadgoogletest-a3dd9d97c57eb1be851a27ffcd6edaed69ee816e.tar.gz
googletest-a3dd9d97c57eb1be851a27ffcd6edaed69ee816e.tar.bz2
googletest-a3dd9d97c57eb1be851a27ffcd6edaed69ee816e.zip
Supports building gtest as a DLL (by Vlad Losev).
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')