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

Robert Dailey rcdailey.lists at gmail.com
Fri Apr 7 09:32:13 EDT 2017


Thanks for the feedback Brad, as always. Really appreciate your
continued help. Sorry for continuing the discussion on the dev list.

To close out the discussion just wanted to share (for others that may
run into this issue) that I went ahead and just added this line to my
root CMakeLists.txt file:

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

This at least disables the root path for programs. I didn't add it to
the toolchain itself since I don't know the impact of doing it, nor do
I really care to support it. I'm slowly trying to move away from
Crystax at my workplace in favor of official NDK since that has built
in support in CMake and also is run a little better (Crystax has been
a fat mess to use; we originally only chose to use it for the prebuilt
libraries, but not worth it)

Thanks again!!

On Fri, Apr 7, 2017 at 7:16 AM, Brad King <brad.king at kitware.com> wrote:
> On 04/06/2017 04:43 PM, Robert Dailey wrote:
>> Even worse, they seem to acknowledge this problem and created "proxy"
>> macros for the use by the host OS (code at the bottom)
>
> Interesting.  That approach depends on all projects using their
> macros instead of the normal `find_package`, requiring explicit
> porting to use their toolchain file.
>
> Typically toolchain files should do this:
>
> ```
> set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
> ```
>
> so that packages for the target platform are found in the
> re-rooted locations but programs are found on the host.
>
> -Brad
>


More information about the cmake-developers mailing list