# CMAKE\_INSTALL\_PREFIX vs installDir in a CMake configure preset

**URL:** https://discourse.cmake.org/t/cmake-install-prefix-vs-installdir-in-a-cmake-configure-preset/15844
**Category:** Usage
**Created:** [September 21, 2026, 1:39pm UTC](https://discourse.cmake.org/t/cmake-install-prefix-vs-installdir-in-a-cmake-configure-preset/15844 "2026-09-21T13:39:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![CsatiZoltan](https://discourse.cmake.org/user_avatar/discourse.cmake.org/csatizoltan/32/5488_2.png) [@CsatiZoltan](https://discourse.cmake.org/u/CsatiZoltan)
#### Post date: [September 21, 2026, 1:39pm UTC](https://discourse.cmake.org/t/cmake-install-prefix-vs-installdir-in-a-cmake-configure-preset/15844/1 "2026-09-21T13:39:54Z")

</div>

I defined a CMake configure preset like this:

```json
{
  "configurePresets": [
    {
      "name": "base",
      "displayName": "Base configuration",
      "cacheVariables": {
        "CMAKE_INSTALL_PREFIX": "install"
      },
      "binaryDir": "build",
      "installDir": "install"
    },
  ]
}

```

I tried, and it turns out that for providing the installation directory, it is sufficient to give either `CMAKE_INSTALL_PREFIX` or `installDir`. Are they interchangeable or there is a difference between the two?

---

<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: [September 22, 2026, 4:02am UTC](https://discourse.cmake.org/t/cmake-install-prefix-vs-installdir-in-a-cmake-configure-preset/15844/2 "2026-09-22T04:02:12Z")

</div>

The [presets documentation](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) for `installDir` provides the answer:

> An optional string representing the path to the installation directory, which will be used as the [`CMAKE_INSTALL_PREFIX`](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html#variable:CMAKE_INSTALL_PREFIX "CMAKE\_INSTALL\_PREFIX") variable.

---

<div class="post-metadata">

### Author: ![CsatiZoltan](https://discourse.cmake.org/user_avatar/discourse.cmake.org/csatizoltan/32/5488_2.png) [@CsatiZoltan](https://discourse.cmake.org/u/CsatiZoltan)
#### Post date: [September 22, 2026, 7:15am UTC](https://discourse.cmake.org/t/cmake-install-prefix-vs-installdir-in-a-cmake-configure-preset/15844/3 "2026-09-22T07:15:35Z")

</div>

Yes, I read the documentation, but I did not understand the consequences of setting directly `CMAKE_INSTALL_PREFIX` in `cacheVariables` instead of setting `installDir`, which implicitly populates `CMAKE_INSTALL_PREFIX`. In other words, what is the role of `installDir` if I can anyway set it in `CMAKE_INSTALL_PREFIX`?

---

<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: [September 22, 2026, 10:01pm UTC](https://discourse.cmake.org/t/cmake-install-prefix-vs-installdir-in-a-cmake-configure-preset/15844/4 "2026-09-22T22:01:30Z")

</div>

I see `installDir` as just a simpler way to specify the install directory. It is not really any different than setting the `CMAKE_INSTALL_PREFIX` cache variable, it’s just that `installDir` is more concise and a bit easier to read and set.
