用CMake构建c++程序时报错:
$ cmake . -- Building for: NMake Makefiles CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake. Update the VERSION argument二、解决办法:value or use a ... suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (project): Running 'nmake' '-?' failed with: 系统找不到指定的文件。 CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! See also "C:/Users/eren.luo/Desktop/test/CMakeFiles/CMakeOutput.log".
p.s. mingw64/bin和cmake已添加至环境变量中。
- 编译时把
cmake .
改为:
cmake -G "MinGW Makefiles" .
- 运行时使用:
mingw32-make.exe all三、C++和cmake版本:
- cmake-3.23.1-windows-x86_64.msi
- mingw-w64-install.exe
系统:Windows 10
四、参考文章:- Running CMake on Windows
- CMAKE_C_COMPILER CMAKE_CXX_COMPILER not set



