hunter_private_data_passwordΒΆ

This module helps to set credentials for downloading private data.

For each hunter_private_data with CREDENTIALS:

# CMakeLists.txt

hunter_private_data(
    URL "..."
    SHA1 "..."
    CREDENTIALS "creds_A"
    LOCATION my_data_A
)

hunter_private_data(
    URL "..."
    SHA1 "..."
    CREDENTIALS "creds_B"
    LOCATION my_data_B
)

You have to define corresponding entry with USERNAME and PASSWORD:

# ~/.config/Hunter/passwords.cmake

hunter_private_data_password(
    CREDENTIALS "creds_A"
    USERNAME "..."
    PASSWORD "..."
)

hunter_private_data_password(
    CREDENTIALS "creds_B"
    USERNAME "..."
    PASSWORD "..."
)

Same CREDENTIALS can be used in several entries, e.g. you can download all private GitHub data using your account name and token:

# CMakeLists.txt

hunter_private_data(
    URL "https://api.github.com/repos/${repo}/${project}/releases/assets/${asset_id_1}"
    SHA1 "${asset_id_1_sha1}"
    CREDENTIALS "github"
    HTTPHEADER "Accept:application/octet-stream"
    LOCATION asset_1
)

hunter_private_data(
    URL "https://api.github.com/repos/${repo}/${project}/releases/assets/${asset_id_2}"
    SHA1 "${asset_id_2_sha1}"
    CREDENTIALS "github"
    HTTPHEADER "Accept:application/octet-stream"
    LOCATION asset_2
)
# ~/.config/Hunter/passwords.cmake

hunter_private_data_password(
    CREDENTIALS "github"
    USERNAME "${username}"
    PASSWORD "${username_github_token}"
)