问题
vscode中使用cmake -B build时报错:
– Building for: NMake Makefiles
CMake Error at CMakeLists.txt:2 (project):
Running
‘nmake’ ‘-?’
failed with:
no such file or directory
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
– Configuring incomplete, errors occurred!
原因
cmake默认nmake生成Makefiles(可用cmake --help查看)
但是找不到nmake
解决方案
指定使用MinGW生成Makefiles
将cmake -B build改为:
cmake -G “MinGW Makefiles” -B build