![]() ![]() Legacy code for the win!Īt one point I was considering building a similar system myself for my personal projects. The whole thing is written in CMake of course. There maps and lists and algorithms and directory traversals and everything you can imagine. ![]() The whole thing was implemented in a collection of complicated macros. It essentially was a big CMake framework that first collected info about every module, looked at the dependencies between them and the needed libraries and then build targets manually for a module by linking explicitly everything that module needed. The strange thing with the module-system was the way it did dependency resolution. In all fairness, I still like the structure of the individual modules. The structure of a module: source, include, test, and data directory a CMakeList.txt file a the root of the module to define all executables and libraries. A big CMakeList.txt file at the top lever with general project settings, a separate file with all of the libraries needed for the project and then a source directory with different modules. The structure was similar to the one of OpenCV. My first experience with a big CMake project was while dealing with legacy code. The cost of CMake – you have no idea what you are supposed to do at the beginning. Freedom and doing things your way! But everything comes with a cost. It didn’t seem that there wasn’t the way of doing it. I quickly noticed how there are a lot of people on the internet talking about their way of doing CMake projects. ![]() I know build systems do not solve an easy problem, but still. At the start, I had the impression that a build system should make everything as easy as possible but it seems that often this is not the case. I have bad memories in my early days of dealing with CMake. In this post, I first want to give a brief overview of my experience with CMake and the present the template project that I have finally settled with. I’ve been meaning to find a good template of a CMake project for a long time and now I think I’ve found\created my long wanted gem. It’s just such a huge hassle to think about all of your CMakeList.txt files and possible libraries and different modules and… the things that may go wrong with your build system. There have been multiple times where when I have to start work on some C project, I’ve to spend a good couple of hours in thinking how should my project structure look like. I am sure that every C programmer has at one point struggled with CMake. ![]()
0 Comments
Leave a Reply. |