I've been working on building projects a project with GoogleTest. Everything works fine when I fetch GoogleTest via FetchContent, but when I use the system version I get a linker error.
I have a user-level directory for CMake packages at /home/alecto/.local/cmake-packages/, and CMAKE_PREFIX_PATH is set to this directory. I installed GoogleTest inside this directory, but CMake still prefers the system version of the package, even though CMake finds other packages installed inside the cmake-packages directory (such as Catch2).
How can I instruct CMake to prefer the version of GoogleTest installed inside /home/alecto/.local/cmake-packages?