language

The language function sets the programming language used by a project.

language ("lang")

Premake currently supports C, C++, and C#. Not all languages are supported by all of the generators; for instance, SharpDevelop does not (currently) support C or C++ development, and Code::Blocks does not support the .NET languages (C#, Managed C++).

Applies To

Solutions and projects.

Parameters

lang is the language identifier. This is a string value, set to one of C, C++, or C#. The value is not case sensitive.

Examples

Set the project language to C++.

language "C++"

Set the project language to C#

language "C#"

"and Code::Blocks does not support the .NET languages."

This wording is a little confusing since C++ can be a .NET language. It might be better to just say "and Code::Blocks does not support C#"

While being pedantic, "C++" cannot be a .NET language, "managed C++" can. It's a different language than C++, though very similar. Your wording is not less confusing / wrong than the original one. My suggestion would be "and Code::Blocks only supports native C++".

Anonimous 1, that information would not be of much use for me, since I come from a C# and .Net background. The ways he explained, though, made me understand his point.

Anonymous 1: In the name of being pedantic, Code::Blocks supports native C++ _and_ plain-old C. =P

It doesn't say what the default value for language() is here. I would assume C, but since the premake4.lua file that comes with Premake 4 explicitly states language('C'), it implies that it is not the default. Does Premake instead use the IDE's primary language as the default or is the presence of language('C') only for clarity? If the former, I would recommend choosing a default, since not doing so would cause issues when someone forgets to specify "C" and then some else, for instance, tries to compile it with #Develop.

- Luiji Maryo