bad link library name for gtest installed with vcpkg
I am constructing a native Windows build of facebook360-dep using vcpkg to install
dependecies, of which there are a great many, and msvc 15 to build.
I have encountered a problem that I can't understand. Here are the facts:
-
The original cmakelists.txt mentions gtest only once, as a link library name. The resulting project specifies that plain name, without any path, as a linker input, and the linker reports a nonexistent file. (I would expect the same result on any platform).
-
gtest installed in my vcpkg tree without incident, and find_package(gtest REQUIRED) finds it, however the resulting CMake Cache shows that it has been handled differently from glog and gflags, for which there are also find_package commands. Those two packages have XXXX_DIR entries in the cache, and their library files are named correctly in the generated projects. All the other packages conform to the same pattern. But for gtest, the cache has entries like
GTEST_LIBRARY C:/Users/tommy/fb360-dep-testing/vcpkg/installed/x64-windows/lib/gtest.lib
These give the correct file names, however the reference in the link libraries command still comes out as a plain name.
-
The gtest package has a couple of anomalous features. It does not have a proper version number, but rather the string "2019-10-09" which cmake will not accept as a version. And it namespaces itself as "GTest::gtest" while all other packages I've seen spell the namespace and symbol names the same. However lowercasing "GTest" does not fix the problem.
-
The module builds OK if I put the correct gtest library name in the project by hand.
In short, a usable library called gtest has been installed in vcpkg and imported in cmake, but somehow a reference to link library 'gtest' does not target it.
I would assume there is a bug in the cmake scripts for the gtest package, so have attached those. The project cmake script is very long but I really can't find anything in it that would distinguish gtest from the other packages named there. Literally all I have done is to add the line " find_package(gtest REQUIRED)". The referencing command is
target_link_libraries( DepUnitTest CalibrationLib LibUtil gtest )