ddavis2speedray / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

VC11 build fix. #408

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
VC11 adds support for all STL11 (for std::tuple), but still doesn't support 
real variadic templates. It uses macro-emulated templates instead. By default, 
max params number is 5, but this value can be increased up to 10.

Gtest contains signatures with std::tuple with 10 template params. To achieve 
full compatibility with VC11 I propose following code:

cmake/internal_utils.cmake (after line 60)

# VC11 contains std::tuple with variadic templates emulation macro.
# _VARIADIC_MAX defaulted to 5 but gtest requires 10.
if (MSVC_VERSION EQUAL 1700)
     set(cxx_base_flags "${cxx_base_flags} -D_VARIADIC_MAX=10")
endif ()

Original issue reported on code.google.com by TheDZ...@gmail.com on 26 Mar 2012 at 8:59

GoogleCodeExporter commented 9 years ago
Increasing _VARIADIC_MAX to 10 works for now.

However, it is not sufficient to define _VARIADIC_MAX only when gtest is built. 
It needs to be defined project-wide so that the actual tests see this 
preprocessor definition, too (e.g. use

    add_definition(-D_VARIADIC_MAX=10)

for the tests if you are using CMake).

Original comment by benjamin...@gmail.com on 8 Apr 2012 at 7:02

GoogleCodeExporter commented 9 years ago
I would like to contribute working VS2012 sample. What should i do? 

Original comment by michael....@gmail.com on 3 Dec 2012 at 1:53

GoogleCodeExporter commented 9 years ago
With latest CMake you can add:
target_compile_definitions(gtest PUBLIC "-D_VARIADIC_MAX=10")

This definition will be pushed to all projects who are dependens on gtest via 
CMake.

Original comment by dipp...@gmail.com on 26 Sep 2013 at 10:16

GoogleCodeExporter commented 9 years ago
This is fixed in r675. https://code.google.com/p/googletest/source/detail?r=675

Original comment by ko...@google.com on 13 Jan 2014 at 11:14