I am trying to get FetchContent to download a pre-compiled library from a gitlab repository that requires authentication.
On command line it looks like this:
curl --header ‘PRIVATE-TOKEN: afw7f9sd87f’ https://repo.url/api/v4/projects/mylib
I tried the following, but neither an error message, nor the file downloaded.
The HTTP_HEADER keyword mentioned by @fenrir is what I’d go with to, but to shed some light on your attempt using curl, CMake doesn’t interpret single quotes like shells do. If you had surrounded the PRIVATE-TOKEN... part with double quotes instead of single quotes, I think it would have worked (it looks like you also have an error where you specified curl twice at the start of the command line, but I assume that was just a typo for the example here).
part with double quotes instead of single quotes, I think it would have worked
Actually I was experimenting with double/singe/no quotes (for half a day) and I did manage to download the remote archive once. But couldn’t reproduce it.