views:

256

answers:

4

What is a good alternative to Makefile on windows?

I'm compiling a collection of c++ files (.cpp's and .h's) using cl.exe.

I'd rather not use Makefile, as I want to minimise the amount of 3rd party utilities people will need to build my application.

Drew J. Sonne.

+3  A: 

MSBuild, the Microsoft build system. It's the XML-based build system used by Visual Studio. If you have Visual C++ installed, you have MSBuild installed.

Visual Studio project files are just MSBuild files, so anything you can do in Visual Studio with project files, you can do by hand (or vice-versa; you can build Visual Studio projects on the command line).

James McNellis
+4  A: 

VisualStudio comes with nmake which would not require any 3rd party tools.

Nic Strong
+1  A: 

I would think that depends on which C++ compilers you are supporting for Windows. If you are exclusively targetting Visual Studio users then simply providing the necessary project files should do the trick as your users can either open them in the IDE or use devenv.exe/msbuild.exe to build your project via the command line. In this case, my suggestion would be to provide the project files for the oldest version of Visual Studio that you support as the newer ones will be able to convert the files to the format they require.

It gets a little more tricky if you are trying to support other C++ compilers for Windows also. Either you'll have to provide project files for all of their IDEs which can be tricky if you don't have access to all of them, or you'll have to go for the lowest common denominator, which would be the simplest Makefile possible and hope that most programmers will have make installed, which isn't an unreasonable assumption.

If your software requires the Boost libraries, another approach would be to provide a set of .jam files as most programmers who have Boost probably have bjam floating around back from when they built Boost. While bjam isn't quite as simple as make, it does have the major advantage that it already knows how to handle multiple compilers. But I would only consider bjam if the software distributed required Boost, otherwise it's another unwanted dependency.

Timo Geusch
A: 

You may want to consider CMake. It can generate NMake makefiles (NMake comes with Visual Studio), Visual Studio project files, GNU Makefiles, and other formats as well.

As long as you don't add/remove any files, you only have to run CMake once, and then others can build your software with NMake. It is very easy to use.

It is especially well-suited for large projects, because it can automatically pick up files and generate build targets for subcomponents (I think KDE uses CMake as its build system now).

http://www.cmake.org/cmake/resources/software.html

Matt Fichman