BASIS  version 1.2.3 (revision 2104)
Public Member Functions | Static Public Member Functions
sbia::basis::ExecutableTargetInfo Class Reference

Provides information about executable build targets. More...

#include <ExecutableTargetInfo.h>

List of all members.

Public Member Functions

std::string get_build_directory (const std::string &target) const
 Get absolute path of output directory of executable in build tree.
std::string get_executable_name (const std::string &target) const
 Get name of executable file without path.
std::string get_installation_directory (const std::string &target) const
 Get absolute path of directory where built executable is installed.
std::string get_target_uid (const std::string &target) const
 Get UID of build target.
bool is_known_target (const std::string &target) const
 Determine whether a given build target is known.

Static Public Member Functions

static const ExecutableTargetInfoinstance ()
 Get static instance of this module.

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.

Note:
This class is not intended to be subclassed.
See also:
get_executable_path()

Definition at line 62 of file ExecutableTargetInfo.h.


Member Function Documentation

string sbia::basis::ExecutableTargetInfo::get_build_directory ( const std::string &  target) const

Get absolute path of output directory of executable in build tree.

Parameters:
[in]targetName/UID of build target.
Returns:
Absolute path of build tree directory where built executable is located or an empty string if build target is not known.

Definition at line 217 of file ExecutableTargetInfo.cxx.

string sbia::basis::ExecutableTargetInfo::get_executable_name ( const std::string &  target) const

Get name of executable file without path.

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

Definition at line 205 of file ExecutableTargetInfo.cxx.

string sbia::basis::ExecutableTargetInfo::get_installation_directory ( const std::string &  target) const

Get absolute path of directory where built executable is installed.

Parameters:
[in]targetName/UID of build target.
Returns:
Absolute path of executable's installation directory or an empty string if build target is not known.

Definition at line 234 of file ExecutableTargetInfo.cxx.

string sbia::basis::ExecutableTargetInfo::get_target_uid ( const std::string &  target) const

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.

Definition at line 173 of file ExecutableTargetInfo.cxx.

const ExecutableTargetInfo & sbia::basis::ExecutableTargetInfo::instance ( ) [static]

Get static instance of this module.

Attention:
This method is not thread-safe!
Returns:
Static instance of this class.

Definition at line 166 of file ExecutableTargetInfo.cxx.

bool sbia::basis::ExecutableTargetInfo::is_known_target ( const std::string &  target) const

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.

Definition at line 195 of file ExecutableTargetInfo.cxx.


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