ubuntu - cmake 在 ubuntu 18.10 中找不到 gtest 1.8

标签 ubuntu cmake googletest

我正在尝试在我的项目上运行 cmake,该项目过去在 Mac 上运行得很好。

在我的 CMakeLists.txt 中,我有:

find_package(gtest 所需配置)

当我运行 cmake 时,我看到:

CMake Error at CMakeLists.txt:123 (find_package):
  Could not find a package configuration file provided by "gtest" with any of
  the following names:

    gtestConfig.cmake
    gtest-config.cmake

  Add the installation prefix of "gtest" to CMAKE_PREFIX_PATH or set
  "gtest_DIR" to a directory containing one of the above files.  If "gtest"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

我已在 /usr/include/gtest 中构建了源代码并将其安装到 /usr/lib/ 中。

最佳答案

调用时find_package ,包的名称区分大小写。与 GTest 相对应的包的正确名称是“GTest”。


大小写不正确的包名称有时可能会起作用(例如,使用不区分大小写的文件系统,或者如果包由 <lower-case-name>-config.cmake 文件描述)。但最好不要依赖这些功能,并使用其文档中注明的包名称。

关于ubuntu - cmake 在 ubuntu 18.10 中找不到 gtest 1.8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54272250/

相关文章:

c++ - 根据gtest框架中的参数生成测试后缀

linux - 如何在ubuntu上更新lua包?

linux - 拒绝不在 AD "Domain Admins"组中的用户登录 linux 机器?

c++ - 将 makefile 转换为 cmake

ffmpeg - 如何在 CMake 中检测 ffmpeg 与 libav?

GTest 的 C++11 问题

c++ - 如何使用 BUCK 仅运行特定的 C++ gtest

Ubuntu autoload_register 上的 PHP 和命名空间问题

ubuntu - 如何将环境变量传递给 systemd 启动的服务

visual-studio-2012 - 访问被拒绝在 Visual Studio 中运行程序