Main Content

target.EnvironmentConfiguration class

Package: target

Configure system environment for toolchain

Description

Use a target.EnvironmentConfiguration object to configure the system environment for a toolchain. For example, configuration of environment variables and execution of vendor-provided setup scripts.

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

Properties

expand all

Operating system that the environment configuration applies to.

Attributes:

GetAccess
public
SetAccess
public

Optional. Setup shell script or batch file that the software calls before executing CMake configure or build commands.

On a Windows® computer, before invoking cmake, the software runs the CALL command from a batch file.

On a Linux® and Mac computers, before invoking cmake, the software runs the source or . command from a Bash shell script.

Attributes:

GetAccess
public
SetAccess
public

Optional. List of paths that must be prepended to the system path before executing cmake configure or build commands.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

This code snippet from Create Custom CMake Toolchain Definition shows how you can use a target.EnvironmentConfiguration object to configure the system environment for a toolchain.

tc.EnvironmentConfiguration(1).HostOperatingSystemSupport.Linux = false;
tc.EnvironmentConfiguration(1).HostOperatingSystemSupport.Windows = true;
tc.EnvironmentConfiguration(1).HostOperatingSystemSupport.Mac = false;
tc.EnvironmentConfiguration(1).SystemPaths = ...
  {'$(MW_MINGW64_LOC)/bin', '$(MATLAB_ROOT)/toolbox/shared/coder/ninja/$(ARCH)'};

tc.EnvironmentConfiguration(2) = target.create('EnvironmentConfiguration');
tc.EnvironmentConfiguration(2).HostOperatingSystemSupport.Linux = true;
tc.EnvironmentConfiguration(2).HostOperatingSystemSupport.Windows = false;
tc.EnvironmentConfiguration(2).HostOperatingSystemSupport.Mac = true;
tc.EnvironmentConfiguration(2).SystemPaths = ...
  {'$(MATLAB_ROOT)/toolbox/shared/coder/ninja/$(ARCH)'};

Version History

Introduced in R2022b