[cmake-developers] find_program() not using PATH on Windows?

Brad King brad.king at kitware.com
Thu Apr 6 16:38:09 EDT 2017


On 04/06/2017 04:32 PM, Robert Dailey wrote:
> directories coming from PATH can be "rerooted" like this, it makes
> things very confusing... maybe there is a reason for it, but I'd never
> want this personally, and I find it concerning that a toolchain file
> can break this for the whole project.

The toolchain file is using CMAKE_FIND_ROOT_PATH to prevent find
commands from searching outside of those directories.  That is
why everything is rerooted.

Often one doesn't want this for programs, so the toolchain file
should set CMAKE_FIND_ROOT_PATH_MODE_PROGRAM to NEVER or BOTH.
If it has some reason for not doing that then one can always use
NO_CMAKE_FIND_ROOT_PATH in the individual find_program call.

-Brad



More information about the cmake-developers mailing list