Search code examples
makefile

CMake does not produce Makefile


I'm using VS Code on windows. I have a simple CMakelists.txt like this:

cmake_minimum_required(VERSION 3.0)

project(HelloWorld)

add_executable(HelloWorld main.cpp)

When I run it, it produces a bunch of build, vcxproj, etc. But it does not create any Makefile. So when I run make I get: make: *** No targets specified and no makefile found. Stop.

Here is a screenshot

screenshot

What is wrong here?


Solution

  • I think you should generate it with cmake -G "Unix Makefiles". It seems like now you have Visual Studio as a default generator. You can check all possible generators with cmake --help.