未知的 CMake 命令“gtest_discover_tests”

Dar*_*aro 4 compilation cmake googletest

有人可以解释一下如何正确安装 Cmake 和 GoogleTest 所以命令

gtest_discover_tests
Run Code Online (Sandbox Code Playgroud)

变得可用?我安装了

cmake-3.23.0-rc3
Run Code Online (Sandbox Code Playgroud)

googletest-release-1.11.0
Run Code Online (Sandbox Code Playgroud)

从源代码,但我仍然无法编译该项目

https://github.com/D-os/libbinder
Run Code Online (Sandbox Code Playgroud)

由于以下错误

CMake Error at tests/CMakeLists.txt:15 (gtest_discover_tests):
Unknown CMake command "gtest_discover_tests".
Run Code Online (Sandbox Code Playgroud)

我使用的是 Slackware 14.2 x64

ixS*_*Sci 5

该函数是在GoogleTest脚本文件(模块)中定义的,因此您需要像这样包含它:include(GoogleTest)

然后就可以使用该功能了。