CMake Compiler not set

CMake Error: CMAKE_Project_COMPILER not set, after EnableLanguage

I Get this Error after writing cmake ..

This is my 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".

>Solution :

You’re using the project command in the wrong way. It should be

project(Project CXX)

That’s why CMake is looking for CMAKE_Project_COMPILER instead of CMAKE_CXX_COMPILER.

Leave a Reply