2

I'm trying to create Ninja build files using CMake GUI.

I've tried to install Ninja on macOS using Brew and manually. Both times I made sure that ninja is available on the PATH but CMake GUI was never able to find ninja.

CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

CMake on command line is able to find ninja. Just cmake-GUI is not.

Any hints highly appreciated.

compor
  • 2,239
  • 1
  • 19
  • 29
Thor_Bux
  • 1,137
  • 12
  • 26

1 Answers1

5

When apps are launched from the Finder (e.g. double-clicking on its icon), it is not necessarily the same PATH as launching from a command line. You can see the difference using a trivial CMakeLists.txt with the following contents:

cmake_minimum_required(VERSION 3.1)
message("ENV{PATH} = $ENV{PATH}")
project(foo)

If you launch the CMake GUI app through the Finder and use the above file as the project to build, the output will probably show a path like this:

ENV{PATH} = /usr/bin:/bin:/usr/sbin:/sbin

If you run CMake GUI from a command line directly (e.g. /Applications/CMake.app/Contents/bin/cmake-gui rather than open /Applications/CMake.app), the PATH should be the same as you are used to seeing from the command line, which for you probably includes /usr/local/bin assuming you've set that in your ~/.bash_profile or similar.

Craig Scott
  • 9,238
  • 5
  • 56
  • 85
  • 2
    WOW... seriously cmake ? like dah ? cmake was able to find ninja after running cmake-gui from terminal. But failed to find if run from CMake.app. Even though ninja was always in my env path. Ninja really likes to play hide and seek. – Alex Jan 01 '20 at 19:19