# CMAKE\_STAGING\_PREFIX can find packages in /opt in Linux Os ?

**URL:** https://discourse.cmake.org/t/cmake-staging-prefix-can-find-packages-in-opt-in-linux-os/6676
**Category:** Code
**Tags:** os:linux, gen:makefiles
**Created:** [October 17, 2022, 5:48am UTC](https://discourse.cmake.org/t/cmake-staging-prefix-can-find-packages-in-opt-in-linux-os/6676 "2022-10-17T05:48:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dglz.hyj](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dglz.hyj/32/2836_2.png) [@dglz.hyj](https://discourse.cmake.org/u/dglz.hyj)
#### Post date: [October 17, 2022, 5:48am UTC](https://discourse.cmake.org/t/cmake-staging-prefix-can-find-packages-in-opt-in-linux-os/6676/1 "2022-10-17T05:48:12Z")

</div>

I hava a project named SRVL .I build and install the project’s librart in opt/srvl and the directory structure show below:

/opt/srvl/lib/cmake/ tree  
.  
└── srvl  
├── SRVLConfig.cmake  
├── SRVLTargets.cmake  
└── SRVLTargets-debug.cmake

all the things about install in opt/srvl  
but when i open a new project and it’s CMakeLists.txt use find(SRVL) and it can find the library correctly.  
 ![image](https://discourse.cmake.org/uploads/default/original/2X/a/a144e67eb60fdd0fd9cb5d72cb65d650f8dc6894.png)

why? I never re-direct the cmake\_prefix for project to use when it find library. So I have to usr NO\* or ONLY signature in findpackage to findout the answer.

as you can see “Only find in CMAKE\_STAGING\_PREFIX” can find it.

the reason why my new project can find SRVL is CMAKE\_STAGING\_PREFIX?  
if yes, another question is : what CMAKE\_STAGING\_PREFIX is in Liunx OS

I use Ubuntu2204 and Ubuntu2004 .  
I read cmake document for a long time.

---

<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: [October 17, 2022, 12:06pm UTC](https://discourse.cmake.org/t/cmake-staging-prefix-can-find-packages-in-opt-in-linux-os/6676/4 "2022-10-17T12:06:26Z")

</div>

It seems that it comes from [this line](https://gitlab.kitware.com/cmake/cmake/-/blob/7a869ebaf13e241d8a2c52a1b5ab3dd4191bf2b6/Modules/Platform/UnixPaths.cmake#L53).
