0

I build my project with CMake.

I want to generate "MinGW Makefiles", but CMake throws me this error:

CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeMinGWFindMake.cmake:12 (message):
  sh.exe was found in your PATH, here:

  C:/Program Files/Git/usr/bin/sh.exe

  For MinGW make to work correctly sh.exe must NOT be in your path.

  Run cmake from a shell that does not have sh.exe in your PATH.

  If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

It seems that only this needs to be deleted:

C:\Program Files\Git\cmd

in my environment variable Path.

So I want to know how to do this in Windows CLI.

Kevin
  • 16,549
  • 8
  • 60
  • 74
curlywei
  • 682
  • 10
  • 18

1 Answers1

1

Try running this in your command line environment before running cmake:

set PATH=%PATH:C:\Program Files\Git\usr\bin;=%

This will remove the specific path (C:\Program Files\Git\usr\bin;) from your PATH string variable, and reassigns PATH, using string substitution.

Kevin
  • 16,549
  • 8
  • 60
  • 74
  • Thanks for your reply. I also want to know how linux do. Would you tell me? – curlywei Aug 19 '19 at 15:22
  • 1
    Please see the answers to this [question](https://unix.stackexchange.com/questions/108873/removing-a-directory-from-path) for Linux cases. – Kevin Aug 19 '19 at 15:25