Normally it is not necessary to specify the path to the CMake generator backend, assuming the generator executable is on the system PATH. In some cases, perhaps testing CMake with several different versions of a generator, one may wish to specify the generator executable via CMAKE_MAKE_PROGRAM. When doing so, the absolute path to the generator is necessary or CMake will not find it.
For example, suppose on a CI one extracts Ninja 1.10 to use CMake and Ninja on a Fortran project. With GitHub Actions on a Linux image, this would be specified like:
- name: Install Ninja run: | curl -O https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip unzip ninja-linux.zip - name: CMake configure run: cmake -G Ninja -DCMAKE_MAKE_PROGRAM=$(realpath ./ninja) -B build
The key point is that we specify the full path from a relative path with realpath to Ninja (when necessary) like:
cmake -G Ninja -DCMAKE_MAKE_PROGRAM=$(realpath ./ninja)