File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,4 +23,22 @@ FetchContent_Declare(aws-sdk-cpp
2323 OVERRIDE_FIND_PACKAGE
2424)
2525
26- FetchContent_MakeAvailable (aws-sdk-cpp)
26+ # Always build the AWS SDK as static archives, even when our own library is
27+ # being built shared (LD_BUILD_SHARED_LIBS=ON). Building aws-sdk-cpp as
28+ # BUILD_SHARED_LIBS=ON produces dylibs on macOS whose dynamodb component
29+ # fails to find AWS Core symbols at link time (the AWS SDK's visibility
30+ # configuration doesn't export them consistently across its FetchContent
31+ # build). Linking aws-sdk-cpp statically into our shared wrapper sidesteps
32+ # the issue and matches the redis pattern of pinning dep build shape via
33+ # a scoped variable rather than overwriting the global BUILD_SHARED_LIBS.
34+ #
35+ # Using a function for scope: `set(BUILD_SHARED_LIBS OFF)` inside the
36+ # function shadows any cached/parent value during FetchContent_MakeAvailable
37+ # without persisting after the call, so user `-D LD_BUILD_SHARED_LIBS=ON`
38+ # for the rest of the project remains untouched.
39+ function (_ld_fetch_aws_sdk_cpp_static )
40+ set (BUILD_SHARED_LIBS OFF )
41+ FetchContent_MakeAvailable (aws-sdk-cpp)
42+ endfunction ()
43+
44+ _ld_fetch_aws_sdk_cpp_static ()
You can’t perform that action at this time.
0 commit comments