# Remove installed libs from windows path

**URL:** <https://discourse.cmake.org/t/remove-installed-libs-from-windows-path/2863>\
**Category:** Code\
**Created:** [March 2, 2021, 12:20am UTC](https://discourse.cmake.org/t/remove-installed-libs-from-windows-path/2863 "2021-03-02T00:20:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmilo9999](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kmilo9999/32/1246_2.png) [@kmilo9999](https://discourse.cmake.org/u/kmilo9999)\
**Post date:** [March 2, 2021, 12:20am UTC](https://discourse.cmake.org/t/remove-installed-libs-from-windows-path/2863/1 "2021-03-02T00:20:26Z")

</div>

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](https://filebin.net/6hsnu290tai2lr6c/cmake_install.cmake?t=8ocgltgg) there is a reference to the local C:\ folder path, but in the [CMakeCache](https://filebin.net/spbhelmgzm9prdnm/CMakeCache.txt?t=5hzd15zg) states that the CMAKE\_INSTALL\_PREFIX is set to D:/OTHER\_PATH

I appreciate the help

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [March 2, 2021, 12:55am UTC](https://discourse.cmake.org/t/remove-installed-libs-from-windows-path/2863/2 "2021-03-02T00:55:42Z")

</div>

Sounds like zlib installed a [`export(PACKAGE)`](https://cmake.org/cmake/help/latest/command/export.html). You can set [`CMAKE_EXPORT_NO_PACKAGE_REGISTRY`](https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY.html) to prevent this in the future.
