Tuesday, December 16, 2014

Why cmake isn't compiling?

Something has caught my attention recently, just come across the CMake and I find it interesting when having some refreshment on C++. When I'm coding, I'm very rely on IDE stuff especially on Visual Studio C++ 6.0, I used to master every single short-cut key on this tool. However I didn't aware of there is a process working behind the scene, until I knew it in one day, and I'm so curious about it.

When I know Makefile, I find that this is the “engine” working behind the scene before compiler can even start to compile. After a long learning curve on Makefile, I realize that this tool definitely not for an idiot! It is a tool that only genius will know how to use it. Until I found CMake, something seem reasonable to understand.

But be cautious, I made some stupid mistake when I first using this tool:
  1. I accidentally miss spelled the file to CMakeList. The correct file name is CMakeLists.txt. The file name end with an s and have txt extension on it.
  2. Missing path-to-source argument when issuing the command cmake. The correct format is cmake .. This is to tell cmake that the source file can be find at current level.

One nice thing about this tool is it will generate a Makefile for me which save me a lot of time. Besides Makefile it generated, it also generate other files which I don't know its usage.

No comments: