User variables

CMake

HUNTER_ENABLED

Turn on/off Hunter package manager. If this variable is OFF HunterGate module will do nothing, hunter_add_package command will have no effects. You can add this variable as option while experimenting to keep backward compatibility with old package manager:

option(HUNTER_ENABLED "Enable Hunter package manager" OFF)
HunterGate(...) # ignored
if(WITH_FOO)
  hunter_add_package(Foo) # ignored
  find_package(Foo) # found in standard location
endif()
  • Default: ON

HUNTER_ROOT

  • Path to Hunter root directory. Set this variable if you don’t want to install Hunter packages to default location
  • You can set environment variable with the same name to avoid specifying it for every project
  • See HunterGate

Warning

If you manually cloned Hunter repository for development purposes the values of URL and SHA1 of HunterGate will be ignored, see notes and testing hints.

HUNTER_STATUS_PRINT

  • Print current build status
  • Default: ON

HUNTER_STATUS_DEBUG

  • Print a lot of info
  • Set this variable to ON before submitting bugs
  • Default: OFF

HUNTER_PACKAGE_LOG_BUILD

HUNTER_PACKAGE_LOG_INSTALL

HUNTER_CONFIGURATION_TYPES

  • Build type of the 3rd party packages
  • See example
  • Default: Release, Debug

HUNTER_BUILD_SHARED_LIBS

HUNTER_JOBS_NUMBER

  • Number of parallel builds that will be used in such native tools like make -jN or xcodebuild -jobs N
  • For Visual Studio >= 12 2013 flag /maxcpucount:N will be added to MSBuild
  • Set variable to 0 to disable adding any flags: HUNTER_JOBS_NUMBER=0
  • Default: NUMBER_OF_LOGICAL_CORES

HUNTER_RUN_INSTALL

Set this variable to ON to run auto-install procedure if it’s disabled by HUNTER_DISABLE_AUTOINSTALL environment variable.

HUNTER_DISABLE_BUILDS

  • Set this variable to YES to disable building packages from sources. This may be useful in case you want to check that package can be loaded fully from local/server cache
  • Default: NO

HUNTER_CACHE_SERVERS

  • Variable contains list of servers with cache binaries
  • For now only GitHub supported (see overview)
  • Variable should be modified before HunterGate command:
list(APPEND HUNTER_CACHE_SERVERS "https://github.com/ingenue/hunter-cache")
HunterGate(URL ... SHA1 ...)

HUNTER_USE_CACHE_SERVERS

  • Policy to control downloading cache from server. Possible values:
  • NO - never download cache from server, use local cache or build from sources
  • ONLY - never build from sources, use server/local cache
  • YES - try to download from server, build from sources if not found
  HUNTER_USE_CACHE_SERVERS
NO ONLY YES
Build from sources yes no yes
Download from server no yes yes
  • Default is empty string. Effectively equivalent to YES.

HUNTER_PASSWORDS_PATH

Path to file with passwords for packages with protected sources.

HUNTER_KEEP_PACKAGE_SOURCES

If this variable is set to YES then Hunter will keep package sources after finishing installation. It may be useful for navigation in code while using debug version of libraries.

This is a workaround for issue #359 and have some usage peculiarities:

  • It does not work well with Hunter cache mechanism. If package binaries will be found on server, then there will be no build stage triggered, hence there will be no sources kept. Use HUNTER_USE_CACHE_SERVERS=NO for always building packages on local machine from sources.
  • Sources will be kept inside Hunter-ID directory. Hence even if all the packages will be using another Hunter-ID, the old Hunter-ID directory should not be removed.
  • Some packages use in-source build (non-CMake packages) and keep all build artifacts along with sources. Hunter will just keep directory and will not track what files was the original sources/what is temporary files for build. Combining with previous peculiarity it’s expected that much more disk space will be used than usually.

Environment

HUNTER_ROOT

  • Same as CMake’s HUNTER_ROOT variable. If both environment and CMake variables are set then CMake has a higher priority

HUNTER_BINARY_DIR

  • Use external directory HUNTER_BINARY_DIR for building external projects. This variable can be used to fix “path too long” error on windows

HUNTER_DISABLE_AUTOINSTALL

Set this environment variable to non-empty value (e.g. HUNTER_DISABLE_AUTOINSTALL=ON) to disable automatic initialization of Hunter root directory by HunterGate module. This will give you more control in some advanced usage situations, see examples. Set HUNTER_RUN_INSTALL=ON CMake variable each time you want to run auto-install procedure. Note that there is no need to set any variables if Hunter root is already installed.

HUNTER_PASSWORDS_PATH

Environment variable with functionality similar to CMake variable with the same name.