Public Member Functions | Protected Member Functions | List of all members
basis::util::IExecutableTargetInfo Class Referenceabstract

Provides information about executable build targets. More...

#include <utilities.h>

+ Inheritance diagram for basis::util::IExecutableTargetInfo:
+ Collaboration diagram for basis::util::IExecutableTargetInfo:

Public Member Functions

virtual std::string basename (const std::string &target) const =0
 Get name of executable file without directory path. More...
 
virtual std::string dirname (const std::string &target) const =0
 Get absolute path to directory containing executable. More...
 
virtual bool istarget (const std::string &target) const =0
 Determine whether a given build target is known. More...
 
virtual std::string targetuid (const std::string &target) const =0
 Get UID of build target. More...
 

Protected Member Functions

 IExecutableTargetInfo ()
 Constructor. More...
 
virtual ~IExecutableTargetInfo ()
 Destructor. More...
 

Detailed Description

Provides information about executable build targets.

Within source code of a BASIS project, other SBIA executables are called only indirectly using the build target name which must be fixed and unique within the lab. The name of the output executable file of these targets may however vary and be finally set by BASIS, for example, depending on whether the project is build as part of a superproject or not. Therefore, each BASIS CMake function may adjust the output name in order to resolve name conflicts with other targets or SBIA executables.

The idea is that a target name is supposed to be stable and known to the developer as soon as the target is added to a CMakeLists.txt file, while the name of the actual executable file is not known a priori as it is set by the BASIS CMake functions during the configure step. Thus, the developer should not rely on a particular name of the executable file. Instead, they can rely on the name of the corresponding build target which was chosen by themselves when adding the target to the build configuration.

In order to get the actual file path of the built executable file, the function get_executable_path() is provided by the stdaux.h module. This function uses the static singleton instance of this class in order to map the given build target name to the name of the built and optionally installed executable. The code which initializes the required maps is generated automatically during the configuration of the build system.

See also
exepath()

Definition at line 88 of file utilities.h.

Constructor & Destructor Documentation

§ IExecutableTargetInfo()

basis::util::IExecutableTargetInfo::IExecutableTargetInfo ( )
inlineprotected

Constructor.

Definition at line 95 of file utilities.h.

§ ~IExecutableTargetInfo()

virtual basis::util::IExecutableTargetInfo::~IExecutableTargetInfo ( )
inlineprotectedvirtual

Destructor.

Definition at line 98 of file utilities.h.

Member Function Documentation

§ basename()

virtual std::string basis::util::IExecutableTargetInfo::basename ( const std::string &  target) const
pure virtual

Get name of executable file without directory path.

Parameters
[in]targetName/UID of build target.
Returns
Name of built executable file without path.

§ dirname()

virtual std::string basis::util::IExecutableTargetInfo::dirname ( const std::string &  target) const
pure virtual

Get absolute path to directory containing executable.

Parameters
[in]targetName/UID of build target.
Returns
Absolute path to directory containing executable file.

§ istarget()

virtual bool basis::util::IExecutableTargetInfo::istarget ( const std::string &  target) const
pure virtual

Determine whether a given build target is known.

Parameters
[in]targetName/UID of build target.
Returns
Whether the given build target is known by this module.

§ targetuid()

virtual std::string basis::util::IExecutableTargetInfo::targetuid ( const std::string &  target) const
pure virtual

Get UID of build target.

In order to be able to distinguish build targets with identical name but which are built as part of different BASIS projects, the UID of a build target is composed of the build target name as given as argument to the basis_add_* CMake functions and a namespace identifier (i.e., the project name in lowercase letters). If the specified build target name is neither known by this module nor a build target UID yet, this method prepends the namespace identifier corresponding to the project this module was built from, assuming that the caller refers to another target within the same project.

Parameters
[in]targetName/UID of build target.
Returns
UID of build target.

The documentation for this class was generated from the following file: