CMake cannot find GoogleTest required library in Ubuntu

后端 未结 4 1293
慢半拍i
慢半拍i 2020-12-14 07:52

Similar issue here.

This is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.6)

# Locate GTest
find_package(GTest REQUIRED)
include_directories($         


        
4条回答
  •  情话喂你
    2020-12-14 08:16

    As explained by @detrick, the Ubuntu package libgtest-dev only installs sources, so you need to build and install the libraries yourself.

    However, there is a much simpler way for building and installing since Ubuntu 18.04 than the manual commands in other answers:

    sudo apt install libgtest-dev build-essential cmake
    cd /usr/src/googletest
    sudo cmake .
    sudo cmake --build . --target install
    

提交回复
热议问题