8

I'm currently investigating cmake to allow automatic building on the Win32 platform. For all runtimes and libraries I'd like to build, Visual Studio (2008/2010) projects do allready exist.

I've come across cmake, but I'm unsure if I really need it. As the documentation says, cmake generates VS projects and they then can be built e.g. using MSBuild.

As the projects itself allready do exist (and build nicely via the IDE or MSBuild on the cmd line), what do I need and use cmake for? Just for directory/project folder traversal? Build failure reporting?

Regards, Paul

PMiller
  • 241
  • 1
  • 5
  • 15
  • 1
    I suppose all you really _need_ is MSBuild and the codebase. Script it however you want it. (cmake, NAnt, etc.) Personally I really like using Rake for my build scripting, though all it's really doing is calling MSBuild (and MSDeploy). But, as a fully-fledged programming tool (Ruby language) it can make for a very powerful scripting agent. – David Apr 10 '12 at 14:59

2 Answers2

8

You don't need it. Cmake is only useful if you are trying to keep the same source code able to build in multiple platforms and compilers. If you are simply building using the microsoft stack you have no need of it.

Alex
  • 12,749
  • 3
  • 31
  • 45
  • Thanks - and how would you script directory traversals? Manually or are there tools which just do that, kicking of whatever I define and then check the return codes and write proper reports? – PMiller Apr 10 '12 at 20:13
  • I'm not sure what you mean by directory traversal, but, I would use any of the major continuous integration platforms like, CruiseControl.NET or Hudson. That, using the fact you said you can build it in either MSBuild and the IDE should get you everything you are currently looking and a platform for other things in the future. You just tell it how to get the source code and point it at your solution file or project file and be most of the way there. – Alex Apr 10 '12 at 23:54
  • I mean that I simply want to define a set of folders where one or more VS projects reside, build them, collect the output/return code and present it. Hudson looks a bit Java focused, will have a look at CruiseControl.NET. – PMiller Apr 11 '12 at 10:13
  • Ahh, then yes CC.NET is exactly what you need to get you started. Good Luck – Alex Apr 11 '12 at 11:58
  • Well, I see that CC.NET needs an ASP.NET capable webserver - which I don't have or plan to have. – PMiller Apr 11 '12 at 12:29
  • THat is only if you want reporting over time. Otherwise you can just have all the reporting in the email. Also, if you only have 1 build server you can just run the web dashboard on that server perhaps??? – Alex Apr 11 '12 at 14:19
  • Right - I have installed IIS on Win 7, so far I haven't investigated much on the dashboard - as localhost/ccnet isn't configured properly by the installer. First I need to get Unix/DOS line endings normalized after CVS (on Linux) checkout/updates... – PMiller Apr 12 '12 at 14:25
8

Well, strictly speaking you do not need it. However, it does give you a few advantages:

  1. The idiomatic way to use CMake, forces you to use out-of-source builds. Arguable, but I am personally convinced that these keep you source-repository very clean.

  2. You can support multiple visual studio versions (with the out-of-source builds). Perhaps it will be a little easier to port your project to other compilers (from MinGW -> Linux GCC).

  3. With the find_package and config.cmake files, and a large number of available findXXX modules, CMake makes it a lot easier to "import" third-party libraries into your build-chain.

André
  • 18,348
  • 6
  • 60
  • 74
  • Well, out-of-source builds are something - but for manually testing and deploying, that's how I kick off a build using the VS IDE itself. The projects are all there, no need to reinvent the wheel (or have duplicated vcxproj files). – PMiller Apr 10 '12 at 20:11
  • 1
    Definitely no need to keep duplicated files. CMake would replace the vcxproj files. For us, CMake provides a central place to adjust project settings (not just for different compilers, but also for different compiler versions). Side note: And yes, it definitely made transisition to Linux/gcc very easy and I can absolutely recommend to look into it (start with a smal project). That said, "never" change a running system. – Johannes S. Apr 12 '12 at 07:11