[CMake] find_program usage
Kyle Edwards
kyle.edwards at kitware.com
Tue Jun 4 09:42:02 EDT 2019
On Tue, 2019-06-04 at 19:07 +0530, vinay kumar Kotegowder wrote:
> Hi Everyone,
>
> This is simple code running on Windows machine:
>
> if(WIN32)
> message(STATUS "On windows")
> find_program(_TOOL
> arm-none-eabi-gcc.exe
> PATHS "C:"
> )
> endif()
>
> message(STATUS "${_TOOL}")
>
> Result after executing: cmake -P mycmake.cmake
>
> -- On windows
> -- _TOOL-NOTFOUND
>
> Can anyone tell me what is wrong with the usage of "find_program" ?
find_program() is looking in C:, but not its subdirectories. So, unless
arm-none-eabi-gcc.exe is located directly in C:, CMake won't find it.
As a side note, GCC isn't typically found with find_program(). You most
likely want to write a cross-compiling toolchain file which contains
this location instead. See below for details:
https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html
Kyle
More information about the CMake
mailing list