Main Content

target.CMakeCacheEntry class

Package: target

Configure a CMake cache entry

Description

Use a target.CMakeCacheEntry object to define a CMake cache entry for the CMake tool. The software adds the cache entry to the command that invokes CMake, using one of these forms:

  • -D Name:Type=Value

  • -D Name=Value

Name, Type, and Value are object properties.

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

Properties

expand all

Name of the CMake cache entry.

If the string value has spaces, for example, name With Spaces, the software passes to the CMake tool the value with double quotes, that is, "name With Spaces".

Attributes:

GetAccess
public
SetAccess
public

Optional. Type of the CMake cache entry.

If the string value has spaces, for example, name With Spaces, the software passes to the CMake tool the value with double quotes, that is, "name With Spaces".

Attributes:

GetAccess
public
SetAccess
public

Value of the CMake cache entry.

If the string value has spaces, for example, name With Spaces, the software passes to the CMake tool the value with double quotes, that is, "name With Spaces".

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

This code snippet shows how you can use the target.CMakeCacheEntry object to define CMake cache entries for the CMake tool.

tc = target.create('Toolchain', 'Name', 'CMake/Ninja for all hosts');
tc.Builder = target.create('CMakeBuilder');
tc.Builder.Generator = 'Ninja';
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++');

Version History

Introduced in R2022b