[C++] CMAKE_PREFIX_PATH changes are not passed on to externalProjects
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### Describe the bug, including details regarding any error messages, version, and platform.
The externalProjects are run in a separate empty env, so any changes done to prefix path (or other CMAKE_* vars) that we don't specifically pass on don't reach the ep CMake.
I think this is a pretty rare edge case but it surfaced in the macOS R submission. Ther runners have boost installed in a non-default prefix which is passed on to CMake via envvar (I suspect, no direct access to the env) so our `resolve_dependency` finds boost and uses that. But the sub-cmake of thrift doesn't have the envvar to hint it boosts path and fails to find it.
We should forward `CMAKE_PREFIX_PATH` and `$ENV{CMAKE_PREFIX_PATH}` to the external projects via `EP_COMMON_CMAKE_ARGS`. The envvar is (different then for other vars) not used to initialize the cmake var, it is just used in `find_package` so we have to forward it explicitly.
### Component(s)
C++
Contributor guide
Assessment
This issue has not been assessed yet.