views:

147

answers:

2

I'm looking for a good and easy in maintenance portable build system for C++ projects. Main platforms should include Windows (Visual Studio 8+) and Linux (gcc); Cygwin may be an advantage. We're considering two main possibilities: CMake and Boost.Jam. SCons can be also an option, but I haven't investigated it yet. CMake and Boost.Jam seem to have the following traits:

CMake:

  • (+) generates native "makefile" (solution for Windows, project for Eclipse)
  • (+) extensions for testing and packaging
  • (-) demands a configuration file in every project folder
  • (-) based on a little too verbose peculiar language

Boost.Jam:

  • builds by itself with no intermediate steps
  • (-) doesn't generate native solutions/projects
  • (+) concise language similar to the classic makefile
  • (+) intuitive support for properties like multithreading and static/dynamic library

What are other possibilities and what is really preferable after experience? What build systems can create a solution on the way?

+2  A: 

I've had some good experiences with premake4: http://industriousone.com/premake

ergosys
+1 for introducing me to this. thanks :-)
Vijay Mathew
+3  A: 

(-) demands a configuration file in every project folder

This is not correct, you just need to pass bigger pathes like:

add_program(foo src/foo.cpp src/main.cpp)

Few notes, about Boost.Jam - first it is not Boost.Jam - bjam on its own quite useless, what you are looking for is Boost.Build which is set of Jam macros that make bjam useful.

Now, I worked with both, and I must admit, Boost.Build is not suitable for any serious projects outside the Boost itself. Need to find library? Can't need to find header? Can't. Need to do something outside of simple build - and you have not idea how to do it as BB documentation... Totally useless and maybe cover 10% of BB. So most of cases you need to ask questions in BB mailing lists and...

So, if you have some complicated project - and you need to make something more then simple compile and link, stay away from Boost.Build.

So if you need to support MSVC I find today CMake as only feasible choice.

I don't tell that CMake is very good system, it has many problems but it is something mostly suitable for cross platform development (if you need to support MSVC).

And if you don't care about MSVC and happy with MinGW... take a look on autotools as well.

About Scons - it is still less mature them CMake.

Artyom
IMHO you should prefer CMake over autotools even if you don't care about MSVC, since it is much easier, and faster. There is a reason, that many (big) open source projects are defecting from autotools to CMake. Which also gives you a huge community of Developers who are familiar with CMake. Additionaly note that CMake has a Company providing support backing it up, which is also quite supportive of open source projects. All that said, CMake is still not perfect.
Fabio Fracassi
Autocrap is more trouble than it's worth. Arcane language to write scripts in (shell and M4), bad documentation, slow runs, and excruciatingly painful to debug (especially for users!) when it does not work as advertised.
zvrba
Thanks for more description of CMake, Boost.Build. It seems the correct choice is really CMake (as I do want MSVC support). I'm going to try a little Premake which looks similar to CMake in building, but is based on Lua scripting language.
Ilia Barahovski