Remove installed libs from windows path

A while ago I built and installed zlib from source code using cmake. I assume the CMAKE_INSTALL_PREFIX variable got set by default to:

C:\Program Files (x86)\zlib

Since then, all the projects that require zlib automatically link to this path. How can I remove it from my environment? I want to create a new project that auto downloads the zlib source, builds it and then link it with other project. But the new project always links to the zlib installed in C:/
For example, in the cmake-install.cmake there is a reference to the local C:\ folder path, but in the CMakeCache states that the CMAKE_INSTALL_PREFIX is set to D:/OTHER_PATH

I appreciate the help

Sounds like zlib installed a export(PACKAGE). You can set CMAKE_EXPORT_NO_PACKAGE_REGISTRY to prevent this in the future.