cmaize.targets/cxx_target

class cmaize.targets/cxx_target.CXXTarget

Bases: BuildTarget

Wraps a target which must be built as part of the build system.

Methods

make_target([...])

Create the target and configure its properties so it is ready to build.

Note

Implements BuildTarget(make_target.

Parameters:
  • self (CXXTarget) – CXXTarget object

  • SOURCE_DIR (path, optional) – Directory containing source code.

  • INCLUDE_DIRS (List[path], optional) – Directories containing files to include.

  • SOURCES (List[path], optional) – Source code files.

  • INCLUDES (List[path], optional) – Include files.

  • CXX_STANDARD (int, optional) – CXX standard number. For example, to set the standard to cxx_std_98, only provide 98.

  • DEPENDS (List[desc], optional) – Dependency target names.

_access_level(_al_access_level)

Abstracts out CMake’s access level concept (public, interface, or private).

Parameters:
  • self (CXXTarget) – CXXTarget object

  • _al_access_level (desc*) – Returned access level.

Returns:

CMake access level of the target.

Return type:

desc

_set_compile_features()

Sets the CXX standard and other compiler features on the CMake target.

Parameters:

self (CXXTarget) – CXXTarget object

_set_include_directories()

Set the target include directories. This adds the include directories as PUBLIC and source directories as PRIVATE. This allows for both public and private headers to be found.

Note

Implements BuildTarget(_set_include_directories.

Parameters:

self (CXXTarget) – CXXTarget object

Set the link libraries for the target. Uses the depends list to determine what targets to link.

Parameters:

self (CXXTarget) – CXXTarget object

_set_public_headers()

Set the public headers on the target. It is set to all include files on this object.

Parameters:

self (CXXTarget) – CXXTarget object

_set_sources()

Set the sources for the target. Sources are set with the PRIVATE accessor so they are not propogated.

Parameters:

self (CXXTarget) – CXXTarget object

Attributes

cxx_standard = "${CMAKE_CXX_STANDARD}"
Type:

int

CXX standard to use. For a given C++ standard designation, denoted as cxx_std_xx or “C++ xx”, only provide the number, “xx” of the standard.

Following the precident set forth by CMake for the CXX_STANDARD target property, this property is initialized to CMAKE_CXX_STANDARD if it is set when the target is created.

source_dir
Type:

path

Directory containing source code files.

sources
Type:

List[path]

Source files.