I'm trying to link-in the AWS C++ SDK for my CMake C++ Project. However, I'm only going to be using a subset of the SDK modules (lambda) and I don't want FetchContent_Declare
to clone the entire repository. I know that I can configure the FetchContent_Declare
with CMAKE_ARGS
and build only the required Lambda SDK by setting the -DBUILD_ONLY=lambda
, but is there a way to configure FetchContent
to only download a single directory, i.e. only required Lambda SDK?
I'm not working on storage-constrained device, but the entire repo is ~400mb which is really a waste if I only need a single client.
Here is the declaration for reference:
# AWS CPP SDK
FetchContent_Declare(
awscppsdk
GIT_REPOSITORY https://github.com/aws/aws-sdk-cpp
GIT_TAG master
CMAKE_ARGS -DBUILD_ONLY=lambda
)
You can't really avoid downloading of
aws-sdk-cpp
, however it's sub-modules could be controlled. See GIT_SUBMODULES .This approach is working for me (have not personally tested lambda module though)