In a cmake project, I download an external project with FetchContent. I am behind a proxy, but this is no problem locally, where I can set the environment variables HTTP_PROXY and HTTPS_PROXY.
However, I want to use an automation server for testing and deployment. On this automation server for some reason, I can set environment variables for the build step, but not for the configure step where FetchContent tries to download the external project.
All I can do is give command-line arguments to cmake.
Solutions that work, but I do not want:
- hardcode the proxy into my CMakeLists.txt by setting an environment variable in cmake
- set the environment variable globally on the automation server
Solutions that do not work:
- giving the http proxy as a cmake cache variable (i.e. cmake -DHTTP_PROXY=...)
Is there any way to give the http proxy to cmake via a command-line option?