# cmake --install prefix not work

**URL:** https://discourse.cmake.org/t/cmake-install-prefix-not-work/5040
**Category:** Usage
**Tags:** os:windows
**Created:** [February 17, 2022, 9:47am UTC](https://discourse.cmake.org/t/cmake-install-prefix-not-work/5040 "2022-02-17T09:47:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [February 17, 2022, 9:47am UTC](https://discourse.cmake.org/t/cmake-install-prefix-not-work/5040/1 "2022-02-17T09:47:45Z")

</div>

[https://zlib.net/zlib-1.2.11.tar.gz](https://zlib.net/zlib-1.2.11.tar.gz)  
I follow the steps to install the project and use the `prefix` in `Install a Project step`. But it doesnt change the install path.

```auto
cd %project%
# Generate a Project Buildsystem
cmake -G "Visual Studio 16 2019" ^
	-S . ^
	-B .\build
# Build a Project
cmake --build . --config Release
# Install a Project
cmake --install . --config Release --prefix ..\release

```

If I follow the steps, it can change the preifx path in `Generate a Project step`

```auto
cmake -G "Visual Studio 16 2019" ^
	-S . ^
	-B .\build-release ^
	-DCMAKE_INSTALL_PREFIX=..\release
cmake --build . --config Release
cmake --install . --config Release --prefix ..\release

```

Who knows the reason ?

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [February 17, 2022, 10:21am UTC](https://discourse.cmake.org/t/cmake-install-prefix-not-work/5040/2 "2022-02-17T10:21:16Z")

</div>

That’s because some people just like to watch the world burn.  
CMakeLists.txt:11-15

```auto
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")

```

This is an issue with how they written their CMake file.

---

<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: [February 17, 2022, 12:46pm UTC](https://discourse.cmake.org/t/cmake-install-prefix-not-work/5040/3 "2022-02-17T12:46:29Z")

</div>

Yes, my [PR from over 5 years ago](https://github.com/madler/zlib/pull/170) has comments about that, but given the lack of interest…not sure how much it’s worth doing anything about it 😕 .

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [February 17, 2022, 8:30pm UTC](https://discourse.cmake.org/t/cmake-install-prefix-not-work/5040/4 "2022-02-17T20:30:12Z")

</div>

It’s getting a bit off-topic, but the zlib project is known for being relatively unresponsive to contributions. The zlib-ng project is an alternative that aims to be better in that regard. It has a zlib API compatibility flag, for those who need it. Their README has more information.

> **[GitHub - zlib-ng/zlib-ng: zlib replacement with optimizations for "next...](https://github.com/zlib-ng/zlib-ng)**
>
> zlib replacement with optimizations for "next generation" systems. - GitHub - zlib-ng/zlib-ng: zlib replacement with optimizations for "next generation" systems.
