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
The following method avoids manually messing with the /usr/lib
directory while also requiring minimal change in your CMakeLists.txt
file. It also lets your package manager cleanly uninstall libgtest-dev
.
The idea is that when you get the libgtest-dev
package via
sudo apt install libgtest-dev
The source is stored in location /usr/src/googletest
You can simply point your CMakeLists.txt
to that directory so that it can find the necessary dependencies
Simply replace FindGTest
with add_subdirectory(/usr/src/googletest gtest)
At the end, it should look like this
add_subdirectory(/usr/src/googletest gtest)
target_link_libraries(your_executable gtest)