ecbuild_declare_project

Initialise an ecBuild project. A CMake project must have previously been declared with project( <name> ... ).

ecbuild_declare_project()

Sets the following CMake variables

<PROJECT_NAME>_GIT_SHA1:

Git revision (if project is a Git repo)

<PROJECT_NAME>_GIT_SHA1_SHORT:

short Git revision (if project is a Git repo)

<PROJECT_NAME>_VERSION:

version as given in project( VERSION )

<PROJECT_NAME>_VERSION_MAJOR:

major version number

<PROJECT_NAME>_VERSION_MINOR:

minor version number

<PROJECT_NAME>_VERSION_PATCH:

patch version number

INSTALL_BIN_DIR:

relative install directory for executables

INSTALL_LIB_DIR:

relative install directory for libraries

INSTALL_INCLUDE_DIR:

relative install directory for include files

INSTALL_DATA_DIR:

relative install directory for data

INSTALL_CMAKE_DIR:

relative install directory for CMake files

Generation of the first two variables can be disabled by setting the ECBUILD_RECORD_GIT_COMMIT_SHA1 option to OFF. This prevents makefiles from being regenerated whenever the Git revision changes.

Customising install locations

The relative installation directories of components can be customised by setting the following CMake variables on the command line or in cache:

INSTALL_BIN_DIR:

directory for installing executables (default: bin)

INSTALL_LIB_DIR:

directory for installing libraries (default: lib)

INSTALL_INCLUDE_DIR:

directory for installing include files (default: include)

INSTALL_DATA_DIR:

directory for installing data (default: share/<project_name>)

INSTALL_CMAKE_DIR:

directory for installing CMake files (default: lib/cmake/<project_name>)

Using relative paths is recommended, which are interpreted relative to the CMAKE_INSTALL_PREFIX. Using absolute paths makes the build non-relocatable and may break the generation of relocatable binary packages.