Could NOT find GTest (missing: GTEST_LIBRARY GTEST_MAIN_LIBRARY) Call Stack
是因为没有安装googletest,参照这篇博客安装时
https://blog.csdn.net/weixin_44401286/article/details/101796958
cmake ../googletest/
输出错误如下:
CMake Error at CMakeLists.txt:13 (if):
if given arguments:
"CMAKE_VERSION" "VERSION_GREATER_EQUAL" "3.1"
Unknown arguments specified
-- Configuring incomplete, errors occurred!
See also "/home/alexander/Downloads/slambook2-master/3rdparty/googletest-master/build/CMakeFiles/CMakeOutput.log".
找到问题:
https://github.com/google/googletest/issues/2711
可能是cmake版本不够高导致的,尝试升级cmake:
https://blog.csdn.net/qq_32526087/article/details/88616116
Curses libraries were not found. Curses GUI for CMake will not be built.
网上查询到是因为没有这个库导致的,所以安装:
sudo apt-get install libcurl4-openssl-dev
然后删除整个文件夹,重新解压压缩包,新建build编译cmake3.11.3
cmake ../googletest/
make
static bool PortableLocaltime(time_t seconds, struct tm* out) {
^
cc1plus: all warnings being treated as errors
CMakeFiles/gtest.dir/build.make:62: recipe for target 'CMakeFiles/gtest.dir/src/gtest-all.cc.o' failed
make[2]: *** [CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/gtest.dir/all' failed
make[1]: *** [CMakeFiles/gtest.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
最后直接按照博客中提供的方法成功解决!
在安装包的googletest文件夹下(/home/bruce/software/googletest-master/googletest)找到CmakeLists.txt, 在其中添加如下语句:
SET(CMAKE_CXX_FLAGS "-std=c++0x")
再次make,便可以成功!最后不要忘记把他们加入自己的库文件夹中:
sudo cp libgtest*.a /usr/lib
sudo cp –a /home/bruce/software/googletest-master/googletest/include/gtestt /usr/include
其中libgtest文件在build文件夹下的lib文件夹中。
By not providing "FindGFlags.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "GFlags", but
CMake did not find one.
Could not find a package configuration file provided by "GFlags" with any
of the following names:
GFlagsConfig.cmake
gflags-config.cmake
查看自己的文件,gflas包是有安装的,但最后还是选择重新源码安装了一次:
git clone https://github.com/gflags/gflags.git
cd gflags
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON -DGFLAGS_NAMESPACE=gflags ../
make -j4
sudo make install
接下来重新reload cmakelist显示成功!