Skip to main content

compileas

Specifies how to treat a file for compilation.

compileas ("value")

Parameters

value is one of:

ValueDescriptionNotes
DefaultCompile based on file extensions built into Premake.
CCompile as a C source file.
C++Compile as a C++ source file.
Objective-CCompile as an Objective-C source file.
Objective-C++Compile as an Objective-C++ source file.
ModuleCompile as a C++20 module interface unit.Premake 5.0.0-beta1 for Visual Studio 2019+
ModulePartitionCompile as a C++20 module interface partition.Premake 5.0.0-beta1 for Visual Studio 2019+
HeaderUnitCompile as a C++20 header unit.Premake 5.0.0-beta1 for Visual Studio 2019+

Applies To

Workspace, project, and file configuration scopes.

Availability

Premake 5.0.0-alpha13 or later.

Examples

filter { "files:**.c" }
compileas "C++"