Compiling mongo-cxx-driver-r3.6.1

You only provided the output for the CMake configure commands. Without the output of the C driver installation it is still not possible to determine the precise issue. However, on my own system, the installation goes into /usr/local by default:

Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/share/mongo-c-driver/COPYING
-- Installing: /usr/local/share/mongo-c-driver/NEWS

Can you confirm that to the case? If it is, then the -DCMAKE_PREFIX_PATH= option is unneeded. Additionally, specifying -DCMAKE_INSTALL_PREFIX=~/mongo/mongo-c-driver-1.17.2/cmake-build tells CMake you want the C++ driver to be installed to the same directory where you built the C driver. You probably do not want this.

In any event, if your CMake defaults to installing somewhere other than /usr/local/ you will need to adjust the -DCMAKE_PREFIX_PATH= option to the C++ driver build to match. If it is installing to /usr/local/, then you may have some other environmental issue that is causing CMake to no longer search /usr/local/lib as it should by default.

Feel free to provide the output of the C driver installation step if you still need assistance to determine where the components are being installed.