CMAKE_STAGING_PREFIX can find packages in /opt in Linux Os ?

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

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.

It seems that it comes from this line.

1 Like