cmaize.targets/cmaize_target
- class cmaize.targets/cmaize_target.CMaizeTarget
Base class for an entire hierarchy of build and install target classes.
Additional Constructors
- CTOR(_ctor_name)
Creates a
CMaizeTarget
object to manage a target of the given name.Note
This does not create a corresponding CMake target, so any call that should interact with a target will fail if the target does not already exist. As a base class with no concrete analog,
CMaizeTarget
really shouldn’t be instantiated aside from testing purposes. Instead, create a child with a concrete target analog and instantiate that.- Parameters:
self (CMaizeTarget) – CMaizeTarget object constructed.
tgt_name (desc or target) – Name of the target. This should not duplicate any other target name already in scope.
_ctor_name (str)
- Returns:
self
will be set to the newly constructedCMaizeTarget
object.- Return type:
Methods
- target(return_target)
Get the CMake target name that the
CMaizeTarget
class represents.- Parameters:
self (CMaizeTarget) – CMaizeTarget object
return_target (desc*) – Name of the CMake target.
- Returns:
Sets
return_target
to the name of the CMake target represented by this class.- Return type:
desc
- has_property(has_property, property_name)
Check if the target has the requested property.
- Parameters:
self (CMaizeTarget) – CMaizeTarget object
has_property (bool*) – Return variable for if the target has the property.
property_name (desc) – Name of the property to check for.
- Returns:
Sets
has_property
according to if the target has the requested property (True) or not (False).- Return type:
bool*
- get_property(property_value, property_name)
Get the requested property for the
CMaizeTarget
.- Parameters:
self (CMaizeTarget) – CMaizeTarget object
property_value (str*) – Return variable for the property value.
property_name (desc) – Name of the property to check for.
- Returns:
Sets
property_value
to the value of the property.- Return type:
str
- Raises:
PropertyNotFound – Property does not exist in the target.
- set_property(_sp_property_name[, ...])
Sets a single property to the given value, creating the property if it does not exist.
- Parameters:
self (CMaizeTarget) – CMaizeTarget object
_sp_property_name (desc) – Name of the property to set.
args (args) – Values of the property. This uses all additional arguments provided to the function as the value for the property. TODO: Verify how to document this parameter properly
- set_properties(_sp_properties)
Sets the given properties to the given values.
Note
Member functions in CMakePPLang cannot be variadic, so it is not possible to match the API for
set_target_properties()
. However, using acpp_map
is close, so it was used. See the example usage below for a concise way of using this function.- Parameters:
self (CMaizeTarget) – CMaizeTarget object
_sp_properties (cpp_map) – Property names and values.
Example Usage
# Create a target so the property functions have something to act on add_custom_target("example_target") # Create a CMaizeTarget object CMaizeTarget(CTOR my_tgt "example_target") # Assign properties using the cpp_map constructor with the optional # key-value pairs in the CTOR call cpp_map(CTOR property_map <property_name_1> <property_value_1> <property_name_2> <property_value_2> <property_name_3> <property_value_3> ... ) # Set the properties on the target with this function CMaizeTarget(set_properties "${property_map}")
Attributes
- install_path
- Type:
path
Directory where the target binary will be installed.
- _name
- Type:
str
Name of the current target.