How to set up googleTest as a shared library on Linux

后端 未结 12 2597
北荒
北荒 2020-11-28 01:04

Debian does not provide any precompiled packages for gTest anymore. They suggest you integrate the framework into your project\'s makefile. But I want to keep my makefile cl

12条回答
  •  难免孤独
    2020-11-28 01:45

    This answer from askubuntu is what worked for me. Seems simpler than other options an less error-prone, since it uses package libgtest-dev to get the sources and builds from there: https://askubuntu.com/questions/145887/why-no-library-files-installed-for-google-test?answertab=votes#tab-top

    Please refer to that answer, but just as a shortcut I provide the steps here as well:

    sudo apt-get install -y libgtest-dev
    sudo apt-get install -y cmake
    cd /usr/src/gtest
    sudo cmake .
    sudo make
    sudo mv libg* /usr/lib/
    

    After that, I could build my project which depends on gtest with no issues.

提交回复
热议问题