# Is it possible to install binaries in one location and cmake packages in another one for third-party libraries?

**URL:** https://discourse.cmake.org/t/is-it-possible-to-install-binaries-in-one-location-and-cmake-packages-in-another-one-for-third-party-libraries/10014
**Category:** Usage
**Created:** [February 6, 2024, 5:14pm UTC](https://discourse.cmake.org/t/is-it-possible-to-install-binaries-in-one-location-and-cmake-packages-in-another-one-for-third-party-libraries/10014 "2024-02-06T17:14:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [February 6, 2024, 5:14pm UTC](https://discourse.cmake.org/t/is-it-possible-to-install-binaries-in-one-location-and-cmake-packages-in-another-one-for-third-party-libraries/10014/1 "2024-02-06T17:14:04Z")

</div>

Hi,

For my own codes, I design my CMakeLists to install the binaries in their own place while the cmake packages are put in a single folder which plays the role of a registry.

But is it possible to do the same thing for a third-party library for which I don’t want to modify its CMakeLists?

Regards  
A.

---

<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 7, 2024, 8:40pm UTC](https://discourse.cmake.org/t/is-it-possible-to-install-binaries-in-one-location-and-cmake-packages-in-another-one-for-third-party-libraries/10014/2 "2024-02-07T20:40:46Z")

</div>

Not in general, no. Many projects do offer `CMAKE_INSTALL_*` variables to change where things get installed though.

---

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [February 8, 2024, 8:25am UTC](https://discourse.cmake.org/t/is-it-possible-to-install-binaries-in-one-location-and-cmake-packages-in-another-one-for-third-party-libraries/10014/3 "2024-02-08T08:25:43Z")

</div>

Hi and thanks for the answer.

Indeed `CMAKE_INSTALL_` vars are available but when setting `CMAKE_INSTALL_LIBDIR` changes the location of the library binary but also of the CMake package directory, which is undesired.

I feel that it should be distinct properties. Don’t you think? Does it deserve to open a feature request?

A.

---

<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 8, 2024, 1:06pm UTC](https://discourse.cmake.org/t/is-it-possible-to-install-binaries-in-one-location-and-cmake-packages-in-another-one-for-third-party-libraries/10014/4 "2024-02-08T13:06:06Z")

</div>

Not all projects are fully controllable like that and will just derive the path like that. A pattern like [this](https://gitlab.kitware.com/vtk/vtk/-/blob/bc9a8c1f848320a1c1e561b90ac257bdd78a5f5b/CMakeLists.txt#L109-115) is what you probably need projects to do; this project may just be forcing the “if not set” part.
