Skip to content
Ruslan Baratov edited this page Jul 12, 2014 · 33 revisions

Standard

By default command ExternalProject_Add will create next directories for project <name>:

TMP_DIR      = <base>/tmp/<name>
STAMP_DIR    = <base>/Stamp/<name>
DOWNLOAD_DIR = <base>/Download/<name>
SOURCE_DIR   = <base>/Source/<name>
BINARY_DIR   = <base>/Build/<name>
INSTALL_DIR  = <base>/Install/<name>

Tagged layout

See hunter_download.cmake.in. Layout of project with name <name[-component]-tag[-debug|-release]>:

TMP_DIR      = ${HUNTER_BASE}/tmp/<name[-component]-tag[-debug|-release]> # unchanged
STAMP_DIR    = ${HUNTER_BASE}/Stamp/<name[-component]-tag[-debug|-release]> # unchanged
DOWNLOAD_DIR = ${HUNTER_BASE}/Download/<name> # use same source for all projects, HUNTER_PACKAGE_DOWNLOAD_DIR (see below)
SOURCE_DIR   = ${HUNTER_BASE}/Source/<name> # use same source for all projects, HUNTER_PACKAGE_SOURCE_DIR
BINARY_DIR   = ${HUNTER_BASE}/Build/<name[-component]-tag[-debug|-release]> # unchanged
INSTALL_DIR  = ${HUNTER_BASE}/Install/<tag> # value of CMAKE_INSTALL_PREFIX, HUNTER_PACKAGE_INSTALL_DIR

HUNTER_BASE is a directory inside HUNTER_ROOT.

Manual installation layout

If hunter installed manually (e.g. by git clone https://github.com/ruslo/hunter):

${HUNTER_ROOT}/_Base # EP_BASE for all projects, HUNTER_BASE
${HUNTER_ROOT}/ # Hunter project itself sources, HUNTER_SELF
${HUNTER_ROOT}/.git # if cloned by git
${HUNTER_ROOT}/cmake/Hunter # master file
${HUNTER_ROOT}/cmake/config.cmake # https://github.com/ruslo/hunter/blob/master/cmake/config.cmake

Gate installation layout

If installed by gate module:

${HUNTER_ROOT}/_Base/${HUNTER_SHA1}/ # EP_BASE for all projects, HUNTER_BASE
${HUNTER_ROOT}/_Base/${HUNTER_SHA1}/Self # Hunter project itself sources, HUNTER_SELF
${HUNTER_ROOT}/_Base/${HUNTER_SHA1}/Self/cmake/Hunter # master file
${HUNTER_ROOT}/_Base/${HUNTER_SHA1}/Self/cmake/config.cmake # https://github.com/ruslo/hunter/blob/master/cmake/config.cmake

Toolchain utils

Additionally directory Toolchains hold some cached info about used toolchain:

${HUNTER_BASE}/Toolchains/<tag>/default_generator.info
${HUNTER_BASE}/Toolchains/<tag>/toolchain.info

Directory lock

Both gate installation and per package installation can be started asynchronously at the same time. Used HUNTER_BASE directory will be locked to avoid conflicts. Next paths used:

${HUNTER_BASE}/directory-lock # when somebody adding package to hunter root 
${HUNTER_BASE}/directory-lock/info # PROJECT_BINARY_DIR of that project
${HUNTER_BASE}/directory-lock/fullinfo # more info, like tag and build time
${HUNTER_BASE}/install-gate-done # This file created by process that have installed hunter by gate module

Overview

  • tag HUNTER_INSTALL_TAG. Default tag value is default. Set in [master] (https://github.com/ruslo/hunter/blob/master/cmake/Hunter) file
  • name HUNTER_PACKAGE_NAME
  • component HUNTER_PACKAGE_COMPONENT need to control install components separately. Otherwise if project have build one component next component will not be build because corresponding Stamp/<name>-install already touched.
  • debug release ... HUNTER_PACKAGE_VARIANTS. For optimization, do not generate/run project if Stamp/<name>-install already touched
  • HUNTER_PACKAGE_BASENAME: <name[-component]-tag>

Example

  • library foo
  • CMAKE_DEBUG_POSTFIX equal d
  • generator Unix Makefiles (Release and Debug builded separately)
  • toolchains: libcxx and libstdcxx

Result will be:

  • create external projects:
  • foo-libcxx-release
  • foo-libcxx-debug
  • foo-libstdcxx-release
  • foo-libstdcxx-debug
  • TMP_DIR:
  • ${HUNTER_BASE}/tmp/foo-libcxx-release
  • ${HUNTER_BASE}/tmp/foo-libstdcxx-release
  • ${HUNTER_BASE}/tmp/foo-libcxx-debug
  • ${HUNTER_BASE}/tmp/foo-libstdcxx-debug
  • STAMP_DIR:
  • ${HUNTER_BASE}/Stamp/foo-libcxx-release
  • ${HUNTER_BASE}/Stamp/foo-libstdcxx-release
  • ${HUNTER_BASE}/Stamp/foo-libcxx-debug
  • ${HUNTER_BASE}/Stamp/foo-libstdcxx-debug
  • DOWNLOAD_DIR:
  • ${HUNTER_BASE}/Download/foo
  • SOURCE_DIR:
  • ${HUNTER_BASE}/Source/foo
  • BINARY_DIR:
  • ${HUNTER_BASE}/Build/foo-libcxx-release
  • ${HUNTER_BASE}/Build/foo-libstdcxx-release
  • ${HUNTER_BASE}/Build/foo-libcxx-debug
  • ${HUNTER_BASE}/Build/foo-libstdcxx-debug
  • INSTALL_DIR:
  • ${HUNTER_BASE}/Install/libcxx
  • ${HUNTER_BASE}/Install/libstdcxx

When using toolchain libcxx:

  • FOO_ROOT will be set to ${HUNTER_BASE}/Install/libcxx
  • find_package will return foo_LIBRARIES as debug;${HUNTER_BASE}/Install/libcxx/food.a;optimized;${HUNTER_BASE}/Install/libcxx/foo.a

... using toolchain libstdcxx:

  • FOO_ROOT will be set to ${HUNTER_BASE}/Install/libstdcxx
  • find_package will return foo_LIBRARIES as debug;${HUNTER_BASE}/Install/libstdcxx/food.a;optimized;${HUNTER_BASE}/Install/libstdcxx/foo.a

Clone this wiki locally