aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorkosak <kosak@google.com>2014-01-13 22:24:15 +0000
committerkosak <kosak@google.com>2014-01-13 22:24:15 +0000
commit7d1051ce2b3be67d27b200d0050a7ec88c18621b (patch)
treeed5e3c915538976af74959e032815c687ef332d4 /CMakeLists.txt
parent6576c64903765304ac42767cdbbc3824446550b0 (diff)
downloadgoogletest-7d1051ce2b3be67d27b200d0050a7ec88c18621b.tar.gz
googletest-7d1051ce2b3be67d27b200d0050a7ec88c18621b.tar.bz2
googletest-7d1051ce2b3be67d27b200d0050a7ec88c18621b.zip
Make Google Test build cleanly on Visual Studio 2010, 2012, 2013.
Also improve an error message in gtest_test_utils.py.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt24
1 files changed, 16 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 57470c84..bd78cfe6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,6 +59,16 @@ include_directories(
# Where Google Test's libraries can be found.
link_directories(${gtest_BINARY_DIR}/src)
+# Summary of tuple support for Microsoft Visual Studio:
+# Compiler version(MS) version(cmake) Support
+# ---------- ----------- -------------- -----------------------------
+# <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple.
+# VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10
+# VS 2013 12 1800 std::tr1::tuple
+if (MSVC AND MSVC_VERSION EQUAL 1700)
+ add_definitions(/D _VARIADIC_MAX=10)
+endif()
+
########################################################################
#
# Defines the gtest & gtest_main libraries. User tests should link
@@ -171,12 +181,10 @@ if (gtest_build_tests)
PROPERTIES
COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
- if (NOT MSVC OR NOT MSVC_VERSION EQUAL 1600)
- # The C++ Standard specifies tuple_element<int, class>.
- # Yet MSVC 10's <utility> declares tuple_element<size_t, class>.
- # That declaration conflicts with our own standard-conforming
- # tuple implementation. Therefore using our own tuple with
- # MSVC 10 doesn't compile.
+ if (NOT MSVC OR MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010.
+ # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that
+ # conflict with our own definitions. Therefore using our own tuple does not
+ # work on those compilers.
cxx_library(gtest_main_use_own_tuple "${cxx_use_own_tuple}"
src/gtest-all.cc src/gtest_main.cc)
@@ -194,8 +202,8 @@ if (gtest_build_tests)
cxx_executable(gtest_break_on_failure_unittest_ test gtest)
py_test(gtest_break_on_failure_unittest)
- # MSVC 7.1 does not support STL with exceptions disabled.
- if (NOT MSVC OR MSVC_VERSION GREATER 1310)
+ # Visual Studio .NET 2003 does not support STL with exceptions disabled.
+ if (NOT MSVC OR MSVC_VERSION GREATER 1310) # 1310 is Visual Studio .NET 2003
cxx_executable_with_flags(
gtest_catch_exceptions_no_ex_test_
"${cxx_no_exception}"