diff options
author | kosak <kosak@google.com> | 2014-01-13 22:28:01 +0000 |
---|---|---|
committer | kosak <kosak@google.com> | 2014-01-13 22:28:01 +0000 |
commit | b93d0f10d5a1bab088223a57420ef599b26a5e0f (patch) | |
tree | 87ef35fe99962b8de504902528d8be44a58b1450 /CMakeLists.txt | |
parent | 04ce8521f481d857db1aa00a206278759b9b0381 (diff) | |
download | googletest-b93d0f10d5a1bab088223a57420ef599b26a5e0f.tar.gz googletest-b93d0f10d5a1bab088223a57420ef599b26a5e0f.tar.bz2 googletest-b93d0f10d5a1bab088223a57420ef599b26a5e0f.zip |
Make Google Mock build cleanly on Visual Studio 2010, 2012, 2013.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 572d0444..4cc66372 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,16 @@ include_directories("${gmock_SOURCE_DIR}/include" # Test sources. "${gtest_SOURCE_DIR}") +# 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 gmock & gmock_main libraries. User tests should link @@ -134,8 +144,16 @@ if (gmock_build_tests) cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + 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(gmock_main_use_own_tuple "${cxx_use_own_tuple}" + "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) + + cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}" + gmock_main_use_own_tuple test/gmock-spec-builders_test.cc) + endif() cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" gmock_main_no_exception test/gmock-more-actions_test.cc) @@ -143,9 +161,6 @@ if (gmock_build_tests) cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}" gmock_main_no_rtti test/gmock-spec-builders_test.cc) - cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}" - gmock_main_use_own_tuple test/gmock-spec-builders_test.cc) - cxx_shared_library(shared_gmock_main "${cxx_default}" "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) |