I have just started using CMake and it has been less than a week. I have a Makefile written and I am trying to write its equivalent in CMake. I don't have an idea about the commands that I should use in CMake for each of the statements in the given Makefile. How do I get started? Is there some place I can find documentation for this?
2 Answers
I just converted my project (~15000 lines of C++ code, builds shared libraries, unit tests, and executables) to CMake from scons a couple of weeks ago, and it only took a day or two to do.
One thing I found helpful was that the Boost project now has experimental support for CMake rather than bjam. Looking through their code (specifically, the macros defined in tools/build/CMake
) taught me a lot about some of the syntax and capabilities of CMake.
Also useful:
- The official CMake FAQ
- The online CMake documentation
- A simple CMake tutorial
- A quick overview of the language/syntax
Hope this helps.

- 14,762
- 6
- 59
- 85
-
Can I ask you why did you decide against scons? I'm currently trying out build tools and scons is my next target. – Tamás Szelei Nov 09 '09 at 10:18
-
3Scons works well for very small projects working on a single platform. Its capabilities to automatically adjust the build process to different architectures (i.e., enabling certain flags on x86_64) was limiting to the point of frustration. There were other things, too; for example, adding build options (choose path to this framework, enable this compiler definition) was hideous in scons and simple in cmake. – Seth Johnson Nov 09 '09 at 13:54
You should really subscribe to CMake mailling list (here) and look at their website in the "help" section, it's great!
If you don't find the answer to your question with some google research, or looking at the mailing list archive (here), then just mail it to the mailing list and nice people will help you!
That's what I did about 2 month ago and now I've got a nice project compiling with cmake! :)

- 9,043
- 17
- 62
- 79