Main Content

target.CMakeBuildType class

Package: target

Describe CMake build type or build configuration

Description

Use a target.CMakeBuildType object to describe a CMake build type (for single configuration generators) or build configuration (for multi-configuration generators) that is supported by a given combination of generator and CMake toolchain file. When you select the associated toolchain for the Toolchain configuration parameter, the build type is available as a Build Configuration option.

To create a target.CMakeBuildType object, use the target.create function.

Properties

expand all

Name of CMake build type. For example, Debug, Release, RelWithDebInfo, and MinSizeRel.

Attributes:

GetAccess
public
SetAccess
public

Data Types: string

Whether the build type supports generation of debug symbols:

  • true –– Supports generation of debug symbols

  • false –– Does not support generation of debug symbols

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Substitute CMake build type for debug workflow. When a workflow requires debug symbols but the current CMake build type does not support the generation of debug symbols, use the property to provide a substitute build type that supports a debug workflow.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

This code snippet from Create Custom CMake Toolchain Definition shows how you can use the SupportedBuildTypes property of a target.CMakeBuilder object and a target.CMakeBuildType object to specify CMake build types for a combination of generator and CMake toolchain file.

tc = target.create('Toolchain', 'Name', 'Example Custom CMake Toolchain');
tc.Builder = target.create('CMakeBuilder');
tc.Builder.Generator = 'Ninja';
tc.Builder.ToolchainFile = fullfile(pwd, 'ExampleCMakeToolchain.cmake');
tc.Builder.SupportedBuildTypes(end+1) = ...
   target.create('CMakeBuildType', ...
   'Name', 'FastMath', ...
   'GeneratesDebugSymbols', false, ...
   'DebugBuildType', 'FastMathWithDebug');
tc.Builder.SupportedBuildTypes(end+1) = ...
   target.create('CMakeBuildType', ...
   'Name', 'FastMathWithDebug', ...
   'GeneratesDebugSymbols', true);

Version History

Introduced in R2022b