Lahey/GNU Fortran


MSBuild is Microsoft's XML-based build system. It is integrated with Visual Studio, but it can also be used on the command line. This section briefly describes how to use MSBuild to build Fortran projects from the command line. For a comprehensive description of MSBuild, see the MSDN documentation for msbuild.exe.

Building a Fortran Project

A Fortran project is built by passing MSBuild the project name. For example, the following command will build the Demo project when it is issued in the directory where the project file exists:

		 msbuild demo.lfproj

Note: MSBuild will not create directories for you, they must already exist when running MSBuild from the command line.

Building Fortran Targets

Fortran targets can be built with the /target: option. For example, to clean the Demo project, use the following command:

		 msbuild /target:Clean demo.lfproj

The default targets provided with every Fortran project are:

Setting Properties

Properties are set with the /property: option. For example, to build the Release version of the Demo project, use the following:

		 msbuild /property:Configuration=Release demo.lfproj

Compiler options can be set as properties for the entire project, but not for individual files. Compile-time options can be sent to the compiler using the "CompileOptions" property. Link-time options can be sent to the compiler using the "LinkOptions" property. When multiple properties are specified, they are separated with semicolons. Each property should contain options just as they are sent to the compiler. If an option contains a space, the entire option string should be enclosed in quotes. Multiple options should be separated with a vertical bar. For example, to specify the compiler options -ap -chk, and the linker option -staticlib use the command:

		 msbuild /property:compileoptions="-ap|-chk";linkoptions="-staticlink" demo.lfproj