First step

Set HUNTER_ROOT environment variable to an empty directory. This directory will be used by HunterGate module for storing packages and utility files. Using environment variable is recommended but not mandatory, see other options.

Set minimum CMake version:

cmake_minimum_required(VERSION 3.2)

Copy HunterGate module to your project and include it:

> mkdir cmake
> wget https://raw.githubusercontent.com/hunter-packages/gate/master/cmake/HunterGate.cmake -O cmake/HunterGate.cmake
include("cmake/HunterGate.cmake")

This module will download archive automatically from URL that you provide to the HUNTER_ROOT directory (it means that there is no need to clone this repository in general, see notes):

HunterGate(
    URL "https://github.com/ruslo/hunter/archive/v0.16.15.tar.gz"
    SHA1 "6974c2150fc0d3b09de3ad1efcbf15d360647ffa"
)

Now project can be started:

project(Foo)

Let’s download and install boost.{regex,system,filesystem}:

hunter_add_package(Boost COMPONENTS regex system filesystem)

Hunter part is done, now well known CMake-style kung fu (see Boost):

find_package(Boost CONFIG REQUIRED regex system filesystem)

add_executable(foo foo.cpp)
target_link_libraries(foo PUBLIC Boost::regex Boost::system Boost::filesystem)

Summarize:

cmake_minimum_required(VERSION 3.2)

include("cmake/HunterGate.cmake")
HunterGate(
    URL "https://github.com/ruslo/hunter/archive/v0.10.9.tar.gz"
    SHA1 "53b198e364dc7bc8360fc545f798563229bd7e20"
)

project(Foo)

hunter_add_package(Boost COMPONENTS regex system filesystem)
find_package(Boost CONFIG REQUIRED regex system filesystem)

add_executable(foo foo.cpp)
target_link_libraries(foo PUBLIC Boost::regex Boost::system Boost::filesystem)

Build it:

> cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON -DCMAKE_BUILD_TYPE=Release
> cmake --build _builds --config Release