CMake: Find libraries in custom install places

If you want cmake to find libraries that are not installed within the default locations (because you installed it using –prefix=/my/special/installpath), you need to tell cmake about this path.

This is done via the cmake variable CMAKE_PREFIX_PATH. You can set it with

cmake -DCMAKE_PREFIX_PATH=/my/special/installpath .

and it will search /my/special/installpath for all of your libraries first. You can also specify more than one path:

cmake -DCMAKE_PREFIX_PATH=/my/special/installpath:/my/second/special/installpath .