CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
1. Error report Description:
Error reporting when building C + + program with cmake:
$ 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 <min> value or use a ...<max> 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:
The system cannot find the specified file.
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".
2. Solution:
P. S. mingw64/bin and cmake have been added to the environment variable.
Modify
cmake .
to:
cmake -G "MinGW Makefiles" .
Use the following commands to run:
mingw32-make.exe all
3. the version of C++ and cmake:
- cmake-3.23.1-windows-x86_64.msi
- mingw-w64-install.exe
System: Windows 10