Proposal: Extend `find_*` calls to support not searching CMAKE_INSTALL_PREFIX.
Background:
There is code in Modules/Platform/UnixPaths.cmake that adds >
CMAKE_INSTALL_PREFIX
to theCMAKE_SYSTEM_PREFIX_PATH
. This was added by commit 507896e0 and commit 2a782880 to support a workflow in which a user interactively builds a chain of dependent projects and installs them all into the same prefix.
The above issue proposes that we remove this behavior with a policy. I believe
that the first step needed to determine if we need the above policy is to first allow enabling and disabling searching the CMAKE_INSTALL_PREFIX
on each find
command.
By bringing CMAKE_INSTALL_PREFIX
per find
command controls over searching
CMAKE_INSTALL_PREFIX
we can evalute if the policy is necessary and provide
requested user functionality.
What would be done
We would implement a new find argument of NO_CMAKE_INSTALL_PREFIX
which would
remove searching CMAKE_INSTALL_PREFIX
when SYSTEM searches are enabled.
This would in-effect make it a finer grained version of NO_CMAKE_SYSTEM_PATH
.
Likewise we would add the CMAKE_FIND_USE_CMAKE_INSTALL_PREFIX
control
variable to allow users to specify this behavior without setting
What will do the work
I will do the work
Why other controls are insufficient
- CMAKE_IGNORE_PATH and related
The CMAKE_IGNORE_PATH
and related controls remove all occurances of a
physical path value from the search. So if we used this control to
ignore the value of CMAKE_INSTALL_PREFIX
it would also remove it from
all searches even if the same value was provided as CMAKE_PREFIX_PATH
- CMAKE_FIND_NO_INSTALL_PREFIX
This flag is a global control switch that needs to be set on the first
configure and before the first call to project
. Since this modifies
global state it means that no one can opt out of the behavior.
Since this is a singular operation that occurs it isn't a suitable place to hang a policy on, as it wouldn't allow sub-projects to switch policy behavior.