This blog is a simple tutorial about how to build gtk program using cmake. cmake is an open source tool to build software program. it is different from Linux command tool. cmake is easy to learn and independent to the compiler. cmake takes inputs from a text file named as CMakeLists.txt and generates Makefile. After getting Makefile we can simply run make command to build the software program. Here is step by step instruction.

build gtk program using cmake

 how to build gtk program using cmake

  • Let us write a simple gtk program main.c

  • Write a CMakeLists.txt

  • Now we have two files main.c and CMakeLists.txt.  run cmake . command in the current working directory. 

build gtk program

  • After running cmake . command , a Makefile would be generated. To build the binary simply run #make command. running make command results a binary ( hellogtk ).  Below is video tutorial