It looks like some recent change has broken the gmock build. We've began receiving this failure on Mac HighSierra 10.13.6:
[ 37%] Building CXX object googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
In file included from .../googletest/src/googletest/googlemock/src/gmock-all.cc:39:
In file included from .../googletest/src/googletest/googlemock/include/gmock/gmock.h:62:
In file included from .../googletest/src/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h:44:
In file included from .../googletest/src/googletest/googlemock/include/gmock/gmock-spec-builders.h:71:
.../googletest/src/googletest/googlemock/include/gmock/gmock-matchers.h:5173:19: warning: variadic templates are a C++11 extension [-Wc++11-extensions]
template
^
.../googletest/src/googletest/googlemock/include/gmock/gmock-matchers.h:5174:77: error: a space is required
between consecutive right angle brackets (use '> >')
internal::ElementsAreMatcher
>
.../googletest/src/googletest/googlemock/include/gmock/gmock-matchers.h:5177:54: error: a space is required
between consecutive right angle brackets (use '> >')
tuple^~
>
.../googletest/src/googletest/googlemock/include/gmock/gmock-matchers.h:5181:19: warning: variadic templates
are a C++11 extension [-Wc++11-extensions]
template
^
.../googletest/src/googletest/googlemock/include/gmock/gmock-matchers.h:5183:52: error: a space is required
between consecutive right angle brackets (use '> >')
tuple^~
>
.../googletest/src/googletest/googlemock/include/gmock/gmock-matchers.h:5186:54: error: a space is required
between consecutive right angle brackets (use '> >')
tuple^~
>
2 warnings and 4 errors generated.
make[5]: * [googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o] Error 1
make[4]: * [googlemock/CMakeFiles/gmock.dir/all] Error 2
Googletest requires C++ 11
Yes, we understand that. We've been building with google test and google mock on our C++11 project for the past 13 months. This is a regression, possibly related to Issue #1865
@gennadiycivil please reopen.
Oh I see
For what it's worth the error is pretty clear , c++ 11 options are not being used in that part of the build
I'm having this same issue in my Travis CI builds (gcc and clang), though it doesn't seem to affect my Appveyor Visual Studio builds.
I suggest taking a look at googletest's travis builds. perhaps addin std=c++11 is in order
I am having a compile issue with Google Test in my Ylikuutio project: https://github.com/nrz/ylikuutio
This might be the same issue, or a different issue. I am using CMake, GCC, Clang, and Travis CI.
To me it seems that the issue is at least partially caused by the Google Test commit e93da23920e5b6887d6a6a291c3a59f83f5b579e , in which the following line is removed from CMakeLists.txt:
set(CMAKE_CXX_STANDARD 11 CACHE STRING "Set the C++ standard to be used for compiling").
As a workaround I am using PATCH_COMMAND git reset --hard 77962730563eece3525f40b8769e4ca0c6baf64c in CMakeLists.txt as follows:
# Download and install GoogleTest
ExternalProject_Add(
googletest
GIT_REPOSITORY https://github.com/google/googletest
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gtest
# Disable install step
INSTALL_COMMAND ""
# Disable update step
UPDATE_COMMAND ""
# custom patch command
PATCH_COMMAND git reset --hard 77962730563eece3525f40b8769e4ca0c6baf64c
LOG_DOWNLOAD ON
LOG_BUILD ON
)
# Download and install GoogleMock
ExternalProject_Add(
googlemock
GIT_REPOSITORY https://github.com/google/googletest
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gmock
# Disable install step
INSTALL_COMMAND ""
# Disable update step
UPDATE_COMMAND ""
# custom patch command
PATCH_COMMAND git reset --hard 77962730563eece3525f40b8769e4ca0c6baf64c
LOG_DOWNLOAD ON
LOG_BUILD ON
)
Google Test commit 77962730563eece3525f40b8769e4ca0c6baf64c (the parent of the failing commit e93da23920e5b6887d6a6a291c3a59f83f5b579e mentioned above) seems to compile fine in my Ylikuutio repository both locally (both GCC and Clang) and using Travis CI (with GCC): https://travis-ci.org/nrz/ylikuutio
It seems strange to me to require setting the C++ standard version in the environment, outside of the project build itself, when it is a known requisite for success. I've tried a quick copy of what the googletest Travis environment-based setting of the standard with no luck so far, but I'll keep tinkering.
I've added -DCMAKE_CXX_FLAGS=-std=c++11 to CMAKE_ARGS for the gtest external project addition, which seems to resolve this. Since this was working (at least for me) even before commit d97dea39b9028073f4dc03ea52d288e1ded460c0, it seems to me that something added in between the addition and subsequent removal of the set(CMAKE_CXX_STANDARD 11) command broke this? But I've looked through those commits and haven't found anything, so I must be missing something.
I am closing this issue
Has the issue been fixed? I'm happy to use @goatshriek workaround above, but I agree, we shouldn't be required to set the environment directly on GTest. If it is required, either our root project environment should carry through, or it should be default in GTest.
@jonbronson we would be happy to look at a PR. Since googletest compiles, builds and tests without any issues it is hard to address "the issue"
I've created #1929 to at least document this for others in the event that a fix isn't created. I've spent some time trying to make one myself without re-introducing the problems mentioned in cba3474435f948e37a76f4dee0c9e717e29f210c, but came up short.
RE: https://github.com/google/googletest/pull/1890 might be relevant?
Indeed, I ran a test on the latest master without setting the version and had no issues. Hopefully this change doesn't regress some of the issues discussed in #1872.
@jonbronson are you still experiencing issues ?
Closing, assuming OK as there is no response
Most helpful comment
For what it's worth the error is pretty clear , c++ 11 options are not being used in that part of the build