[CMake] ExternalProject_Add with gtest and vs2012

Knox, Kent Kent.Knox at amd.com
Tue Jul 10 18:53:32 EDT 2012


Hi all~

I would like to add gtest to my project with ExternalProject_Add(), and I'm using the vs2012 RC compiler to compile everything.  I'm getting compile errors related to gtest using tuples:

4>H:\perforce\bin\vs11x64.SuperBuild\external\gtest\src\gTest\include\gtest/gtest-printers.h(550): error C2977: 'std::tuple' : too many template arguments
4>
4>  2>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\utility(73) : see declaration of 'std::tuple'
4>
4>H:\perforce\bin\vs11x64.SuperBuild\external\gtest\src\gTest\include\gtest/gtest-printers.h(558): error C2977: 'std::tuple' : too many template arguments
4>
4>  2>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\utility(73) : see declaration of 'std::tuple'

This is a known problem with gtest and visual studio 2012, as noted here:
http://stackoverflow.com/questions/8274588/c2977-stdtuple-too-many-template-arguments-msvc11
http://code.google.com/p/googletest/issues/detail?id=412

I would like to define the _VARIADIC_MAX=10 preprocessor definition for the gtest cmake project, such that when my ExternalProject_Add() compiles gtest, this preprocessor symbol is defined and gtest compiles correctly.  I manually tested that the preprocessor definition works.  So how to pass the preprocessor definition though ExternalProject_Add()?  Any ideas?

I would like to avoid having to use the PATCH_COMMAND to patch the gtest cmake files.

Thanks for your ideas,
Kent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120710/7f4871a2/attachment.htm>


More information about the CMake mailing list