CMake错误:未在EnableLanguage之后设置CMAKE_Project_COMPILER
写入cmake ..
后出现此错误
这是我的CMakeLists.txt
set(CMAKE_CXX_COMPILER "C:/mingw64/bin/g++")
set(CMAKE_C_COMPILER "C:/mingw64/bin/gcc")
project(CXX Project)
add_subdirectory(glfw/)
add_executable(${PROJECT_NAME} Main.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC glfw)
target_link_libraries(${PROJECT_NAME} PUBLIC glfw)```
And this is my Complete Error
PS C:\Users\david\Documents\Idle\Project\build> cmake ..
CMake Error at CMakeLists.txt:6 (project):
Running
'nmake' '-?'
failed with:
Das System kann die angegebene Datei nicht finden
CMake Error: CMAKE_Project_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/david/Documents/Idle/Project/build/CMakeFiles/CMakeOutput.log".
3条答案
按热度按时间bvpmtnay1#
您使用the
project
command的方式不对。它应该是这就是为什么CMake正在寻找
CMAKE_Project_COMPILER
而不是CMAKE_CXX_COMPILER
。jq6vz3qz2#
正如您在错误消息
cmake
正在尝试为nmake
生成生成文件,该生成文件是Visual Studio生成系统。您尝试安装的是基于makefile
的带有mingw
的生成系统。因此,您应直接指定生成器:kxkpmulp3#
对于“CMake错误:在启用语言”“之后未设置CMAKE_Project_COMPILER
另一个可能的问题是,我们需要在c:\users\xxx中执行cmake,但无法在c:\xxxx中执行