googletest
googletest copied to clipboard
gtest_main does not discover any tests on Windows (Visual Studio)
I am using googletest in my project without problems on Linux (Ubuntu 16.04, 18.04) and Mac. Now porting the same source to Windows (Visual Studio 15 2017), my googletest binary doesn't find any tests:
Running main() from gtest_main.cc
[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (1 ms total)
[ PASSED ] 0 tests.
(same if I link in gmock_main instead of gtest_main). Now, if I compile in a separate main.cpp:
#include <gmock/gmock.h>
int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv);
testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}
instead of the one provided in gtest_main or gmock_main libraries everything works.
I'm using CMake to build my project, and I don't set any googletest specific settings except
-DGTEST_LINKED_AS_SHARED_LIBRARY
Tested with versions master branch versions 98a0d00 and efecb0b