CMake cannot find GoogleTest required library in Ubuntu(CMake 在 Ubuntu 中找不到 GoogleTest 所需的库)
问题描述
类似问题此处.
这是我的 CMakeLists.txt:
This is my CMakeLists.txt:
还有我的 foo.cpp:
And my foo.cpp:
现在,使用 g++ 编译器时一切正常.但是,在尝试使用 QNX 的编译器 ntox86-c++ 时,我遇到了这个问题:
Now, all works fine when using the g++ compiler. However, when attempting to use QNX's compiler, ntox86-c++, I run into this problem:
CMake 错误在/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (MESSAGE):找不到 GTest(丢失:GTEST_LIBRARY GTEST_INCLUDE_DIRGTEST_MAIN_LIBRARY)
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (MESSAGE): Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
我在 Ubuntu 上使用 ntox86-c++ 编译器、googletest 和 cmake-gui.
I am on Ubuntu using the ntox86-c++ compiler, googletest, and cmake-gui.
是什么?
推荐答案
Google test 可能没有正确安装(libgtest-dev
可能只安装需要编译的源文件).我遇到了同样的问题,我按照 http://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/
Google test was probably not properly installed (libgtest-dev
may install only source files that needed to be compiled). I had the same problem and I followed the instructions from http://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/
这对我有用.
这篇关于CMake 在 Ubuntu 中找不到 GoogleTest 所需的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!