target.CMakeBuilder Class
Namespace: target
Description
Use a target.CMakeBuilder
object to configure how CMake builds
generated code.
To create a target.CMakeBuilder
object, use the target.create
function.
Properties
Optional. Array of additional CMake cache entries to pass to the CMake tool as part of the command line invocation. The software expands the entries in this form:
cmake -D name:type=value ...
Attributes:
GetAccess | public |
SetAccess | public |
Generator that CMake must use, that is, the generator
value for the command cmake -G
.generator
If the string value has no spaces, for example, nameWithNoSpaces
,
the software passes this command to the CMake
tool:
cmake -G nameWithNoSpaces
name With Spaces
, the software
passes this command to the CMake
tool:cmake -G "name With Spaces"
Attributes:
GetAccess | public |
SetAccess | public |
Whether generator is multi-configuration:
true
–– CMake generator supports multiple configurations.false
–– CMake generator supports single configuration
Attributes:
GetAccess | public |
SetAccess | public |
Data Types: logical
Optional. Platform name for the generator, that is, the
platformName
value for the command cmake -A
.platformName
If the string value has no spaces, for example, nameWithNoSpaces
,
the software passes this command to the CMake
tool:
cmake -A nameWithNoSpaces
name With Spaces
, the software
passes this command to the CMake
tool:cmake -A "name With Spaces"
Attributes:
GetAccess | public |
SetAccess | public |
Build types or build configurations supported by generator and toolchain file.
The property is prepopulated with definitions of build types and build
configurations that are available by default. If the Generator
property is set to Ninja Multi-Config
, the build type
MinSizeRel
, is not supported by default. Unless you define
MinSizeRel
in a toolchain file, you must remove it from the object
array. This code snippet shows how you can remove
MinSizeRel
.
tc = target.create('Toolchain', 'Name', 'CMake/Ninja Multi-Config'); tc.Builder = target.create('CMakeBuilder'); tc.Builder.Generator = 'Ninja Multi-Config'; tc.Builder.GeneratorIsMultiConfig = true; tc.Builder.CommandLineCacheEntries(end+1) = ... target.create('CMakeCacheEntry', 'Name', 'CMAKE_C_COMPILER', 'Value', 'gcc'); tc.Builder.CommandLineCacheEntries(end+1) = ... target.create('CMakeCacheEntry', 'Name', 'CMAKE_CXX_COMPILER', 'Value', 'g++'); tc.Builder.SupportedBuildTypes(strcmp({tc.Builder.SupportedBuildTypes}, 'MinSizeRel')) = [];
Attributes:
GetAccess | public |
SetAccess | public |
Optional. Path to a CMake toolchain file, that is, the
toolChain
value for the command cmake -D
CMAKE_TOOLCHAIN_FILE=
.toolChain
If the string value has no spaces, for example, nameWithNoSpaces
,
the software passes this command to the CMake
tool:
cmake -D CMAKE_TOOLCHAIN_FILE=nameWithNoSpaces
name With Spaces
, the
software passes this command to the CMake
tool:cmake -D CMAKE_TOOLCHAIN_FILE="name With Spaces"
Attributes:
GetAccess | public |
SetAccess | public |
Optional. Tool set specification for generator, that is, the
toolSet
value for the command cmake -T
.toolSet
If the string value has no spaces, for example, nameWithNoSpaces
,
the software passes this command to the CMake
tool:
cmake -T nameWithNoSpaces
name With Spaces
, the software
passes this command to the CMake
tool:cmake -T "name With Spaces"
Attributes:
GetAccess | public |
SetAccess | public |
Examples
This code snippet from Create Custom CMake Toolchain Definition shows
how you can use the Builder
property of the
target.Toolchain
object and a target.CMakeBuilder
object to
configure how CMake builds generated code.
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)