Open voltamund opened 4 years ago
I just noticed that I never reacted to this issue - sorry for that...
For my understanding (currently not working with C++): I assume that the gmock.dll you are using also contains the gtest stuff, but is this the common case? Wouldn't one expect executables to have both dependencies?
I will tag this as enhancement, and it is a very simple change. However, I'm not convinced that this is a common case - feel free to change my mind :-)
Hi. I found this ticket because I'm struggling with undiscovered tests in a project where I (was) moved from some ancient 1.8.something static gtestd.lib to 1.11.0 shared library build by vcpkg.
I can't say if this issue is relevant for my problem but regarding the posed question here I found two hints:
A user states in this conan issue: gmock built as a shared library must use static gtest (I could not find the original README quote after a quick search though.)
There is another ticket that reports convincing reasons against using both gtest.dll and gmock.dll for the same binary (TLDR: both don't share a global variable that's supposed to be unique in the binary) at the googletest repo. Understandably, Google treats this more as a user/build issue than something to be fixed in the googletest project.
I just ran my test binary (without TestExplorer), which is only linked against gmock.dll, it must contain the gtest part statically since there is no gtest.dll in that folder or %PATH%.
I didn't go as far as looking up or trying if conan changed Google's CMake project also includes gtest in the gmock library:
if (MSVC)
cxx_library(gmock
"${cxx_strict}"
"${gtest_dir}/src/gtest-all.cc"
src/gmock-all.cc)
This closes the circle to the other bincrafters/conan issue. Google does it now like the user proposes. So it should hardly ever be necessary to link against both.
Maybe that changes your mind? :)
It probably does :-) Would you be willing to give a new version a try and see whether it indeed fixes your particular discovery problem? That would most likely push me over the edge :-)
I'd be delighted 😁
I used the default installation (no indicator file and no custom regex). The test executable only depends on gmock.dll (verified with dumpbin). In that case IsGoogleTestExecutable returns false because it expects gtest.dll as a dependency. As a workaround I could set a custom regex. Then test discovery succeeds.