CetPackagePath

Defines the function cet_package_path() to calculate a path relative to a project’s top level directory.

cet_package_path

Calculate a path relative to the top-level directory of a project.

cet_package_path(<out-var> [<option>] ...)

Options

BASE_SUBDIR <base-subdir>

Calculate the path relative to <proj-top>/<base-subdir>; <base-subdir> must be a relative path.

BINARY

Look for the path in the project’s build tree (default: both source and build trees).

FOUND_VAR <var>

Return an indication of the path’s location: SOURCE (found in the project’s source tree), BINARY (found in the project’s binary tree) or NOTFOUND.

HUMAN_READABLE

<out-var> will contain a human-readable represtation of the calculated relative path.

MUST_EXIST

If the path does not exist <out-var> will be set to NOTFOUND.

PATH <path>

The path for which the relative location should be calculated. If not specified, default to the current source or binary directory, as appropriate. <path> may be an absolute or relative path.

SOURCE

Look for the path in the project’s source tree (default: both source and build trees).

SUBDIR <source-subdir>

Deprecated since version 2.10.00: use PATH <source-subdir> SOURCE

TOP_PROJECT

Use the top-level—as opposed to the current—project in order to calculate the relative path.

Non-option arguments

<out-var>

The name of a variable in which to return the calculated path.

Details

Calculate the path to <path> (or CMAKE_CURRENT_(SOURCE|BINARY)_DIR) relative to (PROJECT|CMAKE)_(SOURCE|BINARY)_DIR[/<base-subdir>] and save the result in <out-var>.

Specifying both SOURCE and BINARY is equivalent to specifying neither.