C++ project generator2 min read

Another day at home, I was trying to get my head around Cmake. It is a tool that I must learn since I want to code in C/C++ in the future. So I dig into youtube and learnt what is necessary for a while. However, after making a few test projects, it seemed unnecessary to know those syntaxes by a heart and it is enough to have some automated tools to generate Cmake for me.

Calling the script and showing its result.

Yeah, then I started coding with python and ended up with a script that can be called an automatic C++ project generator. This script takes a project name, path, and names of classes as arguments then generate CmakeLists.txt, MakeFile for a master project controller, and basic folder structures and header and source files. For an instance, the above shows that a project “King” is generated at “/home/tim/Desktop/PythonTricks/c prj creator” directory with “Soldier, Queen, General, Cavalary” classes.


MakeFile is a master controller that can run clean, run_cmake, and run commands for the project. run_cmake call a few CMake commands to build the project. With this script, a process of building C++ project becomes easier. I am sure that a powerful IDE has this built-in; but, hey, I had fun coding it. From here, the script can be seen.

Update: Oh drear sweet summer child, I was kidding before about setting cmake automatically. Nowadays, I make them manually. This good C++ course playlist led me have this practice.

Leave a Reply

Your email address will not be published. Required fields are marked *

20 − 12 =

%d bloggers like this: