我用CMake构建我的项目。
我想生成"MinGW制作文件", 但是CMake给我抛出了这个错误:
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!
似乎只需要删除这个:
C:Program FilesGitcmd
在我的环境中变量Path
.
所以我想知道如何在Windows CLI中做到这一点。
在运行cmake
之前,请尝试在命令行环境中运行以下命令:
set PATH=%PATH:C:Program FilesGitusrbin;=%
这将从PATH
字符串变量中删除特定路径(C:Program FilesGitusrbin;
(,并使用字符串替换重新分配PATH
。