Search code examples
cmakefileclion

How to configurate CLion to work with makefile instead of CMake.txt?


I downloaded CLion IDE for C language development. When I create a new C project as a default IDE creates CMake.txt file, but I have a requirement (in university) work with makefile.

So, question is - how to change the configuration from CMake.txt to makefile?

Because here in configuration block I see CMake project, but don't see makefile project

enter image description here

CMake structure

cmake_minimum_required(VERSION 3.15)
project(test_c C)

set(CMAKE_C_STANDARD 90)

add_executable(test_c main.c)

makefile structure

myprog1 : main.o
    gcc -g main.o -Wall -ansi -pedantic -o myprog1
main.o : main.c info.h
    gcc -c main.c -Wall -ansi -pedantic -o main.o

Solution

  • CLion uses CMakeLists.txt to build your code. But the CMakeList generates a Makefile. So you don't have to configure CLion to work with a Makefile since it's auto generated at compilation by the CMakeLists. I recommend you to keep the CMakeLists because CLion uses it as configuration.

    But if you want to use your own Makefile, you can create one as you usually do, and create a new build configuration. I suggest you to read this peace of documentation from CLion: Managing Makefile Projects