Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VC11 build fix. #408

Closed
GoogleCodeExporter opened this issue Jul 28, 2015 · 4 comments
Closed

VC11 build fix. #408

GoogleCodeExporter opened this issue Jul 28, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants