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

Brad King brad.king at kitware.com
Fri Apr 7 08:16:32 EDT 2017


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