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

Robert Dailey rcdailey.lists at gmail.com
Thu Apr 6 16:41:28 EDT 2017


Unsetting these at the bottom of the toolchain file fixes it:

unset( CMAKE_FIND_ROOT_PATH )
unset( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM )
unset( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY )
unset( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE )

However I'm not sure if this is the right solution. They do for some
reason specify PROGRAM to ONLY. Should these values propagate outside
of the toolchain file?

On Thu, Apr 6, 2017 at 3:38 PM, Brad King <brad.king at kitware.com> wrote:
> 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