hunter_private_data

This module helps to download user’s private data.

Private file that is available without specifying password:

# CMakeLists.txt

hunter_private_data(
    URL "https://example.com/myfile.txt"
    SHA1 "abcxxxxxx123"
    FILE "myfile.txt"
    LOCATION myfile_path
)

Warning

Changing name specified in FILE or enabling/disabling FILE is not allowed after download done.

Variable myfile_path can be used now, for example in test:

add_test(NAME foo COMMAND foo --text-file ${myfile_path})

If FILE is not specified then archive is assumed. Hunter will unpack it and return path to unpacked directory in LOCATION variable:

# CMakeLists.txt

hunter_private_data(
    URL "https://example.com/archive.tar.gz"
    SHA1 "abcxxxxxx123"
    LOCATION mydata_dir
)

add_test(
    NAME foo
    COMMAND
    foo
    --text-file ${mydata_dir}/poem.txt
    --image-file ${mydata_dir}/cat.png
)

If you need to download file protected with password you have to add CREDENTIALS:

hunter_private_data(
    URL "https://example.com/archive.tar.gz"
    SHA1 "abcxxxxxx123"
    CREDENTIALS "creds"
    LOCATION mydata_dir
)

And add corresponding entry in Hunter passwords file using hunter_private_data_password module:

# ~/.config/Hunter/passwords.cmake

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