aboutsummaryrefslogtreecommitdiffstats
path: root/scons/SConscript
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
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')
-rw-r--r--scons/SConscript19
1 files changed, 19 insertions, 0 deletions
diff --git a/scons/SConscript b/scons/SConscript
index 25220eea..a2c31dc1 100644
--- a/scons/SConscript
+++ b/scons/SConscript
@@ -292,6 +292,25 @@ if BUILD_TESTS:
GtestBinary(env_without_rtti, 'gtest_no_rtti_test', gtest_main_no_rtti,
['../test/gtest_unittest.cc'])
+ # Tests that gtest works when built as a DLL on Windows.
+ # We don't need to actually run this test.
+ # Note: this is not supported under VC 7.1.
+ if env['PLATFORM'] == 'win32' and env.get('GTEST_BUILD_DLL_TEST', None):
+ test_env = EnvCreator.Create(env, EnvCreator.DllBuild)
+ dll_env = test_env.Clone()
+ dll_env.Append(LINKFLAGS=['-DEF:../src/gtest.def'])
+
+ gtest_dll = dll_env.SharedLibrary(
+ target='gtest_dll',
+ source=[dll_env.SharedObject('gtest_all_dll',
+ '../src/gtest-all.cc'),
+ dll_env.SharedObject('gtest_main_dll',
+ '../src/gtest_main.cc')])
+ # TODO(vladl@google.com): Get rid of the .data[1] hack. Find a proper
+ # way to depend on a shared library without knowing its path in advance.
+ test_env.Program('gtest_dll_test_',
+ ['../test/gtest_dll_test_.cc', gtest_dll.data[1]])
+
############################################################
# Sample targets.