vcpkg does not work for google test
I think that the autolinking behavior has been intentionally disabled for gtest
, see vcpkg issue #306.
Original comment on the issue: here.
The vcpkg implementation requires manual linking because Google Test can redefine main()
, and the gtest functionality is duplicated in all of the four separate library files.
Official documentation.
The required per project configuration:
In: Configuration Properties
> Linker
> Input
> Additional Dependencies
For release-builds:
$(VcpkgRoot)lib\manual-link\gtest_main.lib
For debug-builds:
$(VcpkgRoot)debug\lib\manual-link\gtest_main.lib
If you want to create your own custom main(), replace gtest_main.lib
with gtest.lib
.
If you want to use gmock, you can replace it with gmock_main.lib
or gmock.lib
.