Skip to content

find_(library|file|path): Drop PATH-derived search prefixes

Since CMake 3.3, commit ffc06c12, we search in <prefix>/include and <prefix>/lib directories for prefixes with bin directories in the PATH environment variable. The motivation was to search the installation prefixes of MSYS and MinGW development environments automatically.

This behavior can search undesired prefixes that happen to be in the PATH for unrelated reasons. It was reverted for non-Windows hosts within a year by CMake 3.6, commit b30b32a4, but was kept on Windows hosts to support its motivating use case. However, similar problems have since been observed on Windows. For example, !7962 (merged) was primarily due to undesired discovery of libraries in PATH-derived prefixes.

Since !8796 (merged) we search MSYS and MinGW environments' prefixes explicitly, so PATH-derived prefixes are no longer needed for the original motivating use case.

Fixes: #24216 (closed)

Edited by Brad King

Merge request reports